hwmon: (iio_hwmon) Fix missing iio_channel_release_all call if devm_kzalloc fail
authorAxel Lin <axel.lin@ingics.com>
Tue, 23 Apr 2013 17:06:43 +0000 (17:06 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 12 May 2013 05:55:07 +0000 (22:55 -0700)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/iio_hwmon.c

index aafa4531b9614e4b068c9b91698927272c7dc588..368497fa2627477d50246219f960980fdb058126 100644 (file)
@@ -84,8 +84,10 @@ static int iio_hwmon_probe(struct platform_device *pdev)
                return PTR_ERR(channels);
 
        st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL);
-       if (st == NULL)
-               return -ENOMEM;
+       if (st == NULL) {
+               ret = -ENOMEM;
+               goto error_release_channels;
+       }
 
        st->channels = channels;