hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mfd/pcf50633-adc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* NXP PCF50633 ADC Driver
23 *
34 * (C) 2006-2008 by Openmoko, Inc.
....@@ -6,11 +7,6 @@
67 *
78 * Broken down from monstrous PCF50633 driver mainly by
89 * Harald Welte, Andy Green and Werner Almesberger
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms of the GNU General Public License as published by the
12
- * Free Software Foundation; either version 2 of the License, or (at your
13
- * option) any later version.
1410 *
1511 * NOTE: This driver does not yet support subtractive ADC mode, which means
1612 * you can do only one measurement per read request.
....@@ -140,6 +136,7 @@
140136 void *callback_param)
141137 {
142138 struct pcf50633_adc_request *req;
139
+ int ret;
143140
144141 /* req is freed when the result is ready, in interrupt handler */
145142 req = kmalloc(sizeof(*req), GFP_KERNEL);
....@@ -151,7 +148,11 @@
151148 req->callback = callback;
152149 req->callback_param = callback_param;
153150
154
- return adc_enqueue_request(pcf, req);
151
+ ret = adc_enqueue_request(pcf, req);
152
+ if (ret)
153
+ kfree(req);
154
+
155
+ return ret;
155156 }
156157 EXPORT_SYMBOL_GPL(pcf50633_adc_async_read);
157158