Skip to content

Commit d81dac3

Browse files
Dan Carpenterjic23
authored andcommitted
iio: inkern: fix a NULL dereference on error
In twl4030_bci_probe() there are some failure paths where we call iio_channel_release() with a NULL pointer. (Apparently, that driver can opperate without a valid channel pointer). Let's fix it by adding a NULL check in iio_channel_release(). Fixes: 2202e1f ('drivers: power: twl4030_charger: fix link problems when building as module') Signed-off-by: Dan Carpenter <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9d0be85 commit d81dac3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/inkern.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ EXPORT_SYMBOL_GPL(iio_channel_get);
351351

352352
void iio_channel_release(struct iio_channel *channel)
353353
{
354+
if (!channel)
355+
return;
354356
iio_device_put(channel->indio_dev);
355357
kfree(channel);
356358
}

0 commit comments

Comments
 (0)