Deleted Added
full compact
if_ath_btcoex.c (331722) if_ath_btcoex.c (332303)
1/*-
2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 *
1/*-
2 * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
28 *
29 * $FreeBSD: stable/11/sys/dev/ath/if_ath_btcoex.c 331722 2018-03-29 02:50:57Z eadler $
29 * $FreeBSD: stable/11/sys/dev/ath/if_ath_btcoex.c 332303 2018-04-08 20:50:16Z emaste $
30 */
31#include <sys/cdefs.h>
30 */
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/11/sys/dev/ath/if_ath_btcoex.c 331722 2018-03-29 02:50:57Z eadler $");
32__FBSDID("$FreeBSD: stable/11/sys/dev/ath/if_ath_btcoex.c 332303 2018-04-08 20:50:16Z emaste $");
33
34/*
35 * This implements some very basic bluetooth coexistence methods for
36 * the ath(4) hardware.
37 */
38#include "opt_ath.h"
39#include "opt_inet.h"
40#include "opt_wlan.h"

--- 411 unchanged lines hidden (view full) ---

452 if (ad->ad_id & ATH_DIAG_DYN) {
453 /*
454 * Allocate a buffer for the results (otherwise the HAL
455 * returns a pointer to a buffer where we can read the
456 * results). Note that we depend on the HAL leaving this
457 * pointer for us to use below in reclaiming the buffer;
458 * may want to be more defensive.
459 */
33
34/*
35 * This implements some very basic bluetooth coexistence methods for
36 * the ath(4) hardware.
37 */
38#include "opt_ath.h"
39#include "opt_inet.h"
40#include "opt_wlan.h"

--- 411 unchanged lines hidden (view full) ---

452 if (ad->ad_id & ATH_DIAG_DYN) {
453 /*
454 * Allocate a buffer for the results (otherwise the HAL
455 * returns a pointer to a buffer where we can read the
456 * results). Note that we depend on the HAL leaving this
457 * pointer for us to use below in reclaiming the buffer;
458 * may want to be more defensive.
459 */
460 outdata = malloc(outsize, M_TEMP, M_NOWAIT);
460 outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO);
461 if (outdata == NULL) {
462 error = ENOMEM;
463 goto bad;
464 }
465 }
466 switch (id) {
467 default:
468 error = EINVAL;
461 if (outdata == NULL) {
462 error = ENOMEM;
463 goto bad;
464 }
465 }
466 switch (id) {
467 default:
468 error = EINVAL;
469 goto bad;
469 }
470 if (outsize < ad->ad_out_size)
471 ad->ad_out_size = outsize;
472 if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
473 error = EFAULT;
474bad:
475 if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
476 free(indata, M_TEMP);
477 if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL)
478 free(outdata, M_TEMP);
479 return (error);
480}
481
470 }
471 if (outsize < ad->ad_out_size)
472 ad->ad_out_size = outsize;
473 if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
474 error = EFAULT;
475bad:
476 if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
477 free(indata, M_TEMP);
478 if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL)
479 free(outdata, M_TEMP);
480 return (error);
481}
482