Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933261Ab3CRV2H (ORCPT ); Mon, 18 Mar 2013 17:28:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45908 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756274Ab3CRVID (ORCPT ); Mon, 18 Mar 2013 17:08:03 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , Guenter Roeck Subject: [ 32/48] hwmon: (sht15) Fix memory leak if regulator_enable() fails Date: Mon, 18 Mar 2013 14:08:40 -0700 Message-Id: <20130318210812.526574563@linuxfoundation.org> X-Mailer: git-send-email 1.8.1.2.434.g9a6c84e.dirty In-Reply-To: <20130318210810.247845918@linuxfoundation.org> References: <20130318210810.247845918@linuxfoundation.org> User-Agent: quilt/0.60-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1242 Lines: 39 3.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ben Hutchings 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 --- Applies to stable branches between 3.0 and 3.6 where commit 3e78080f8148 has been applied. drivers/hwmon/sht15.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -930,7 +930,7 @@ static int __devinit sht15_probe(struct if (ret != 0) { dev_err(&pdev->dev, "failed to enable regulator: %d\n", ret); - return ret; + goto err_free_data; } /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/