linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: gmbnomis@gmail.com (Simon Baatz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] mtd: nand: orion: fix clk handling
Date: Wed, 29 Mar 2017 21:36:08 +0200	[thread overview]
Message-ID: <20170329193607.GA24737@gandalf> (raw)
In-Reply-To: <20170327181949.isafnqsnxkzed5nv@pengutronix.de>

Hello Uwe,

On Mon, Mar 27, 2017 at 08:19:49PM +0200, Uwe Kleine-K?nig wrote:
> Hello,
> 
> > @@ -145,15 +151,13 @@ static int __init orion_nand_probe(struct platform_device *pdev)
> >  	if (board->dev_ready)
> >  		nc->dev_ready = board->dev_ready;
> >  
> > -	platform_set_drvdata(pdev, mtd);
> > +	platform_set_drvdata(pdev, info);
> >  
> >  	/* Not all platforms can gate the clock, so it is not
> >  	   an error if the clock does not exists. */
> > -	clk = clk_get(&pdev->dev, NULL);
> > -	if (!IS_ERR(clk)) {
> > -		clk_prepare_enable(clk);
> > -		clk_put(clk);
> > -	}
> > +	info->clk = devm_clk_get(&pdev->dev, NULL);
> > +	if (!IS_ERR(info->clk))
> > +		clk_prepare_enable(info->clk);
> 
> you could to the following here instead:
> 
> 	info->clk = devm_clk_get(&pdev->dev, NULL);
> 	if (IS_ERR(info->clk))
> 		/*
> 		 * We ignore all errors here, that's wrong but only for
> 		 * one commit.
> 		 */
> 		info->clk = NULL;
> 
> 	ret = clk_prepare_enable(info->clk);
> 	if (ret) ...
> 

Makes sense.  I don't think we should have such a comment, though. 
The patch description states what it fixes and the patch fixes
exactly that.  Moreover, I tagged this patch for stable (because of
the double free it fixes) and there might be no other commit.  (I
think the error handling problem is not severe enough for stable.  It
has been this way a couple of years and nobody seems to have
noticed.)


- Simon

  reply	other threads:[~2017-03-29 19:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 18:02 [PATCH v2 1/2] mtd: nand: orion: fix clk handling Simon Baatz
2017-03-27 18:02 ` [PATCH v2 2/2] mtd: nand: orion: improve handling of optional clock Simon Baatz
2017-03-27 18:19 ` [PATCH v2 1/2] mtd: nand: orion: fix clk handling Uwe Kleine-König
2017-03-29 19:36   ` Simon Baatz [this message]
2017-03-29 19:39     ` Uwe Kleine-König
2017-03-29 19:40     ` Boris Brezillon
2017-03-29 20:03 ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170329193607.GA24737@gandalf \
    --to=gmbnomis@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).