.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* NXP PCF50633 ADC Driver |
---|
2 | 3 | * |
---|
3 | 4 | * (C) 2006-2008 by Openmoko, Inc. |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Broken down from monstrous PCF50633 driver mainly by |
---|
8 | 9 | * 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. |
---|
14 | 10 | * |
---|
15 | 11 | * NOTE: This driver does not yet support subtractive ADC mode, which means |
---|
16 | 12 | * you can do only one measurement per read request. |
---|
.. | .. |
---|
140 | 136 | void *callback_param) |
---|
141 | 137 | { |
---|
142 | 138 | struct pcf50633_adc_request *req; |
---|
| 139 | + int ret; |
---|
143 | 140 | |
---|
144 | 141 | /* req is freed when the result is ready, in interrupt handler */ |
---|
145 | 142 | req = kmalloc(sizeof(*req), GFP_KERNEL); |
---|
.. | .. |
---|
151 | 148 | req->callback = callback; |
---|
152 | 149 | req->callback_param = callback_param; |
---|
153 | 150 | |
---|
154 | | - return adc_enqueue_request(pcf, req); |
---|
| 151 | + ret = adc_enqueue_request(pcf, req); |
---|
| 152 | + if (ret) |
---|
| 153 | + kfree(req); |
---|
| 154 | + |
---|
| 155 | + return ret; |
---|
155 | 156 | } |
---|
156 | 157 | EXPORT_SYMBOL_GPL(pcf50633_adc_async_read); |
---|
157 | 158 | |
---|