From: Axel Lin Date: Mon, 13 May 2013 13:37:26 +0000 (+0800) Subject: hwmon: (iio_hwmon) Fix null pointer dereference X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=159c8cddd9259e9379f37f0a69ddcbb01c4e8b77;p=deliverable%2Flinux.git hwmon: (iio_hwmon) Fix null pointer dereference This patch fixes the null pointer dereference in goto error_release_channels path when allocate memory for st fails. Reported-by: Dan Carpenter Signed-off-by: Axel Lin Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 368497fa2627..52b77afebde1 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -161,7 +161,7 @@ static int iio_hwmon_probe(struct platform_device *pdev) error_remove_group: sysfs_remove_group(&dev->kobj, &st->attr_group); error_release_channels: - iio_channel_release_all(st->channels); + iio_channel_release_all(channels); return ret; }