From patchwork Tue Mar 19 03:00:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 228908 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 9DA952C00B8 for ; Tue, 19 Mar 2013 14:01:10 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UHmnN-00083M-2i; Tue, 19 Mar 2013 03:01:01 +0000 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UHmnK-00083C-H6 for kernel-team@lists.ubuntu.com; Tue, 19 Mar 2013 03:00:58 +0000 Received: from [2001:470:1f08:1539:d98f:da4e:f620:7bea] (helo=deadeye.wl.decadent.org.uk) by shadbolt.decadent.org.uk with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UHmnI-0005uT-Lv; Tue, 19 Mar 2013 03:00:56 +0000 Received: from ben by deadeye.wl.decadent.org.uk with local (Exim 4.80) (envelope-from ) id 1UHmnG-0007US-A5; Tue, 19 Mar 2013 03:00:54 +0000 Message-ID: <1363662049.3937.363.camel@deadeye.wl.decadent.org.uk> Subject: Re: [PATCH 66/88] hwmon: (sht15) Check return value of regulator_enable() From: Ben Hutchings To: Luis Henriques Date: Tue, 19 Mar 2013 03:00:49 +0000 In-Reply-To: <1363257381-15900-67-git-send-email-luis.henriques@canonical.com> References: <1363257381-15900-1-git-send-email-luis.henriques@canonical.com> <1363257381-15900-67-git-send-email-luis.henriques@canonical.com> X-Mailer: Evolution 3.4.4-2 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2001:470:1f08:1539:d98f:da4e:f620:7bea X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Cc: kernel-team@lists.ubuntu.com, Mark Brown , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Guenter Roeck X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com On Thu, 2013-03-14 at 10:35 +0000, Luis Henriques wrote: > 3.5.7.8 -stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Mark Brown > > commit 3e78080f81481aa8340374d5a37ae033c1cf4272 upstream. > > Not having power is a pretty serious error so check that we are able to > enable the supply and error out if we can't. > > Signed-off-by: Mark Brown > Signed-off-by: Guenter Roeck > Signed-off-by: Luis Henriques > --- > drivers/hwmon/sht15.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c > index 8b011d0..eb01802 100644 > --- a/drivers/hwmon/sht15.c > +++ b/drivers/hwmon/sht15.c > @@ -926,7 +926,13 @@ static int __devinit sht15_probe(struct platform_device *pdev) > if (voltage) > data->supply_uV = voltage; > > - regulator_enable(data->reg); > + ret = regulator_enable(data->reg); > + if (ret != 0) { > + dev_err(&pdev->dev, > + "failed to enable regulator: %d\n", ret); > + return ret; > + } > + > /* > * Setup a notifier block to update this if another device > * causes the voltage to change This needs the same fix-up as in 3.4.y: --- From: Ben Hutchings Subject: hwmon: sht15: Fix memory leak if regulator_enable() fails Date: Sat, 16 Mar 2013 04:11:01 +0000 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 --- --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -930,7 +930,7 @@ if (ret != 0) { dev_err(&pdev->dev, "failed to enable regulator: %d\n", ret); - return ret; + goto err_free_data; } /*