Linux-ide Archive mirror
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Ma Ke <make_ruc2021@163.com>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] ata: sata_mv: aspeed: fix value check in mv_platform_probe()
Date: Tue, 10 Oct 2023 09:06:41 +0000	[thread overview]
Message-ID: <ZSUUIGgzcAPudwdK@x1-carbon> (raw)
In-Reply-To: <2c877878-7e30-43d6-ba93-d37cc2fbb1ef@kernel.org>

On Tue, Oct 10, 2023 at 07:33:49AM +0900, Damien Le Moal wrote:
> On 10/9/23 21:49, Ma Ke wrote:
> > In mv_platform_probe(), check the return value of clk_prepare_enable()
> > and return the error code if clk_prepare_enable() returns an
> > unexpected value.
> > 
> > Signed-off-by: Ma Ke <make_ruc2021@163.com>
> > ---
> >  drivers/ata/sata_mv.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> > index 45e48d653c60..df3a02e7a50b 100644
> > --- a/drivers/ata/sata_mv.c
> > +++ b/drivers/ata/sata_mv.c
> > @@ -4125,8 +4125,10 @@ static int mv_platform_probe(struct platform_device *pdev)
> >  	hpriv->clk = clk_get(&pdev->dev, NULL);
> >  	if (IS_ERR(hpriv->clk))
> >  		dev_notice(&pdev->dev, "cannot get optional clkdev\n");
> > -	else
> > -		clk_prepare_enable(hpriv->clk);
> > +	else {
> > +		rc = clk_prepare_enable(hpriv->clk);
> > +		goto err;
> 
> This is wrong. The goto err should only be done if there is an error.
> Did you even test your own patch ???

The "if (rc)" was there in V1....

I should have caught this in my review of V2.

BTW, if we want to be compliant with the coding kernel standard,
you should also have braces on the if (IS_ERR()),
since there are braces on the else-clause.


Kind regards,
Niklas

      reply	other threads:[~2023-10-10  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 12:49 [PATCH v2] ata: sata_mv: aspeed: fix value check in mv_platform_probe() Ma Ke
2023-10-09 14:22 ` Niklas Cassel
2023-10-09 22:33 ` Damien Le Moal
2023-10-10  9:06   ` Niklas Cassel [this message]

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=ZSUUIGgzcAPudwdK@x1-carbon \
    --to=niklas.cassel@wdc.com \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=make_ruc2021@163.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).