Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755596AbbESKlj (ORCPT ); Tue, 19 May 2015 06:41:39 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:42322 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753471AbbESKlf (ORCPT ); Tue, 19 May 2015 06:41:35 -0400 Message-ID: <1432032089.15181.22.camel@pengutronix.de> Subject: Re: [PATCH v3 1/9] misc: sram: fix enabled clock leak on error path From: Philipp Zabel To: Vladimir Zapolskiy Cc: Heiko =?ISO-8859-1?Q?St=FCbner?= , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Date: Tue, 19 May 2015 12:41:29 +0200 In-Reply-To: <1431976122-4228-2-git-send-email-vladimir_zapolskiy@mentor.com> References: <1431976122-4228-1-git-send-email-vladimir_zapolskiy@mentor.com> <1431976122-4228-2-git-send-email-vladimir_zapolskiy@mentor.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1541 Lines: 48 Am Montag, den 18.05.2015, 22:08 +0300 schrieb Vladimir Zapolskiy: > If devm_gen_pool_create() fails, the previously enabled sram->clk is > not disabled on probe() exit. > > Signed-off-by: Vladimir Zapolskiy > --- > drivers/misc/sram.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c > index eeaaf5f..b44a423 100644 > --- a/drivers/misc/sram.c > +++ b/drivers/misc/sram.c > @@ -90,16 +90,17 @@ static int sram_probe(struct platform_device *pdev) > if (!sram) > return -ENOMEM; > > + sram->pool = devm_gen_pool_create(&pdev->dev, > + ilog2(SRAM_GRANULARITY), -1); > + if (!sram->pool) > + return -ENOMEM; > + > sram->clk = devm_clk_get(&pdev->dev, NULL); > if (IS_ERR(sram->clk)) > sram->clk = NULL; > else > clk_prepare_enable(sram->clk); Here you move sram->clk around, and later in patch 7 it gets moved again. To me it looks like the two should be squashed together. > > - sram->pool = devm_gen_pool_create(&pdev->dev, ilog2(SRAM_GRANULARITY), -1); > - if (!sram->pool) > - return -ENOMEM; > - > /* > * We need an additional block to mark the end of the memory region > * after the reserved blocks from the dt are processed. regards Philipp -- 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/