Skip to content

Commit

Permalink
iio: inkern: fix a NULL dereference on error
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Dan Carpenter authored and jic23 committed Jan 30, 2016
1 parent 9d0be85 commit d81dac3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iio/inkern.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ EXPORT_SYMBOL_GPL(iio_channel_get);

void iio_channel_release(struct iio_channel *channel)
{
if (!channel)
return;
iio_device_put(channel->indio_dev);
kfree(channel);
}
Expand Down

0 comments on commit d81dac3

Please sign in to comment.