.. | .. |
---|
136 | 136 | void *callback_param) |
---|
137 | 137 | { |
---|
138 | 138 | struct pcf50633_adc_request *req; |
---|
| 139 | + int ret; |
---|
139 | 140 | |
---|
140 | 141 | /* req is freed when the result is ready, in interrupt handler */ |
---|
141 | 142 | req = kmalloc(sizeof(*req), GFP_KERNEL); |
---|
.. | .. |
---|
147 | 148 | req->callback = callback; |
---|
148 | 149 | req->callback_param = callback_param; |
---|
149 | 150 | |
---|
150 | | - return adc_enqueue_request(pcf, req); |
---|
| 151 | + ret = adc_enqueue_request(pcf, req); |
---|
| 152 | + if (ret) |
---|
| 153 | + kfree(req); |
---|
| 154 | + |
---|
| 155 | + return ret; |
---|
151 | 156 | } |
---|
152 | 157 | EXPORT_SYMBOL_GPL(pcf50633_adc_async_read); |
---|
153 | 158 | |
---|