From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
Mark Rutland <mark.rutland@arm.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Rob Herring <robh+dt@kernel.org>,
linux-crypto@vger.kernel.org,
Sascha Hauer <kernel@pengutronix.de>,
Matt Mackall <mpm@selenic.com>, Shawn Guo <shawnguo@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC
Date: Mon, 29 Feb 2016 22:38:50 +0100 [thread overview]
Message-ID: <20160229213850.GS2613@pengutronix.de> (raw)
In-Reply-To: <CAOMZO5BN-1U6vX0HAHWX30t+23NnqEpOw6AttSgvqaZnq=cN6Q@mail.gmail.com>
On Mon, Feb 29, 2016 at 06:16:50PM -0300, Fabio Estevam wrote:
> On Mon, Feb 29, 2016 at 12:52 PM, Steffen Trumtrar
> <s.trumtrar@pengutronix.de> wrote:
>
> > + ret = clk_prepare_enable(rngc->clk);
> > + if (ret)
> > + return ret;
> > +
> > + rngc->irq = platform_get_irq(pdev, 0);
> > + if (!rngc->irq) {
> > + dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> > + clk_disable_unprepare(rngc->clk);
> > +
> > + return ret;
>
> You are returning the wrong error code here:
>
> Better do like this:
>
> rngc->irq = platform_get_irq(pdev, 0);
> if (rngc->irq < 0) {
rngc->irq is unsigned, so this is never true.
> dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> clk_disable_unprepare(rngc->clk);
> return rngc->irq;
> }
So here comes my better approach:
ret = platform_get_irq(pdev, 0);
if (ret <= 0) {
if (ret == 0)
ret = -EINVAL;
dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
clk_disable_unprepare(rngc->clk);
return ret;
}
rngc->irq = ret;
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2016-02-29 21:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 15:52 [PATCH 1/3] Documentation: devicetree: add Freescale RNGC binding Steffen Trumtrar
2016-02-29 15:52 ` [PATCH 2/3] ARM: i.MX25: add RNGC node to dtsi Steffen Trumtrar
2016-03-01 13:37 ` Shawn Guo
2016-02-29 15:52 ` [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC Steffen Trumtrar
2016-02-29 21:16 ` Fabio Estevam
2016-02-29 21:38 ` Uwe Kleine-König [this message]
[not found] ` <20160229213850.GS2613-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-02-29 23:54 ` Fabio Estevam
2016-03-01 7:49 ` Uwe Kleine-König
2016-03-07 13:03 ` Steffen Trumtrar
2016-03-03 23:56 ` [PATCH 1/3] Documentation: devicetree: add Freescale RNGC binding Rob Herring
-- strict thread matches above, loose matches on Subject: below --
2016-03-11 14:06 [PATCH v2 " Steffen Trumtrar
2017-07-17 21:16 ` [PATCH v3 " Martin Kaiser
[not found] ` <1500326163-4556-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-07-17 21:16 ` [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC Martin Kaiser
2017-07-18 5:49 ` PrasannaKumar Muralidharan
2017-07-19 21:22 ` Martin Kaiser
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=20160229213850.GS2613@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=galak@codeaurora.org \
--cc=herbert@gondor.apana.org.au \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mpm@selenic.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=s.trumtrar@pengutronix.de \
--cc=shawnguo@kernel.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).