Deleted Added
full compact
if_ath_spectral.c (331722) if_ath_spectral.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_spectral.c 331722 2018-03-29 02:50:57Z eadler $
29 * $FreeBSD: stable/11/sys/dev/ath/if_ath_spectral.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_spectral.c 331722 2018-03-29 02:50:57Z eadler $");
32__FBSDID("$FreeBSD: stable/11/sys/dev/ath/if_ath_spectral.c 332303 2018-04-08 20:50:16Z emaste $");
33
34/*
35 * Implement some basic spectral scan control logic.
36 */
37#include "opt_ath.h"
38#include "opt_inet.h"
39#include "opt_wlan.h"
40

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

207 if (ad->ad_id & ATH_DIAG_DYN) {
208 /*
209 * Allocate a buffer for the results (otherwise the HAL
210 * returns a pointer to a buffer where we can read the
211 * results). Note that we depend on the HAL leaving this
212 * pointer for us to use below in reclaiming the buffer;
213 * may want to be more defensive.
214 */
33
34/*
35 * Implement some basic spectral scan control logic.
36 */
37#include "opt_ath.h"
38#include "opt_inet.h"
39#include "opt_wlan.h"
40

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

207 if (ad->ad_id & ATH_DIAG_DYN) {
208 /*
209 * Allocate a buffer for the results (otherwise the HAL
210 * returns a pointer to a buffer where we can read the
211 * results). Note that we depend on the HAL leaving this
212 * pointer for us to use below in reclaiming the buffer;
213 * may want to be more defensive.
214 */
215 outdata = malloc(outsize, M_TEMP, M_NOWAIT);
215 outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO);
216 if (outdata == NULL) {
217 error = ENOMEM;
218 goto bad;
219 }
220 }
221 switch (id) {
222 case SPECTRAL_CONTROL_GET_PARAMS:
223 memset(&peout, 0, sizeof(peout));

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

270 break;
271 case SPECTRAL_CONTROL_ENABLE:
272 /* XXX TODO */
273 case SPECTRAL_CONTROL_DISABLE:
274 /* XXX TODO */
275 break;
276 default:
277 error = EINVAL;
216 if (outdata == NULL) {
217 error = ENOMEM;
218 goto bad;
219 }
220 }
221 switch (id) {
222 case SPECTRAL_CONTROL_GET_PARAMS:
223 memset(&peout, 0, sizeof(peout));

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

270 break;
271 case SPECTRAL_CONTROL_ENABLE:
272 /* XXX TODO */
273 case SPECTRAL_CONTROL_DISABLE:
274 /* XXX TODO */
275 break;
276 default:
277 error = EINVAL;
278 goto bad;
278 }
279 if (outsize < ad->ad_out_size)
280 ad->ad_out_size = outsize;
281 if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
282 error = EFAULT;
283bad:
284 if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
285 free(indata, M_TEMP);
286 if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL)
287 free(outdata, M_TEMP);
288 return (error);
289}
290
279 }
280 if (outsize < ad->ad_out_size)
281 ad->ad_out_size = outsize;
282 if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size))
283 error = EFAULT;
284bad:
285 if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL)
286 free(indata, M_TEMP);
287 if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL)
288 free(outdata, M_TEMP);
289 return (error);
290}
291