hwmon: (iio_hwmon) Fix null pointer dereference
authorAxel Lin <[email protected]>
Mon, 13 May 2013 13:37:26 +0000 (21:37 +0800)
committerGuenter Roeck <[email protected]>
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 <[email protected]>
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
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;
 }