From: Ben Hutchings Date: Sat, 16 Mar 2013 13:32:16 +0000 (-0700) Subject: hwmon: (sht15) Fix memory leak if regulator_enable() fails X-Git-Tag: v3.4.37~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=969ff7dc5423e50938e7b42b59fe1163aced714c;p=thirdparty%2Fkernel%2Fstable.git hwmon: (sht15) Fix memory leak if regulator_enable() fails Commit 3e78080f8148 ('hwmon: (sht15) Check return value of regulator_enable()') depends on the use of devm_kmalloc() for automatic resource cleanup in the failure cases, which was introduced in 3.7. In older stable branches, explicit cleanup is needed. Signed-off-by: Ben Hutchings Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index eb0180221d04b..c68963023cab5 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -930,7 +930,7 @@ static int __devinit sht15_probe(struct platform_device *pdev) if (ret != 0) { dev_err(&pdev->dev, "failed to enable regulator: %d\n", ret); - return ret; + goto err_free_data; } /*