hwmon: (iio_hwmon) Fix null pointer dereference
authorAxel Lin <axel.lin@ingics.com>
Mon, 13 May 2013 13:37:26 +0000 (21:37 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 13 May 2013 13:43:14 +0000 (06:43 -0700)
This patch fixes the null pointer dereference in goto error_release_channels
path when allocate memory for st fails.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/iio_hwmon.c

index 368497fa2627477d50246219f960980fdb058126..52b77afebde120a17ce75bf6401103cad556d021 100644 (file)
@@ -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;
 }