From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC
Date: Tue, 1 Mar 2016 08:49:37 +0100 [thread overview]
Message-ID: <20160301074937.GU2613@pengutronix.de> (raw)
In-Reply-To: <CAOMZO5BLYumOrBuoB5-RgzLAJ=o4zp9ocv4jcZRy=p6Pky1SyQ@mail.gmail.com>
Hello Fabio,
On Mon, Feb 29, 2016 at 08:54:19PM -0300, Fabio Estevam wrote:
> On Mon, Feb 29, 2016 at 6:38 PM, Uwe Kleine-K?nig
> <u.kleine-koenig@pengutronix.de> wrote:
> > 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:
>
> As irq is only used inside probe it can be removed from struct mxc_rngc.
Good idea.
> Or maybe like this:
>
> ret = platform_get_irq(pdev, 0);
> if (ret < 0) {
> dev_err(&pdev->dev, "FSL RNGC couldn't get irq\n");
> clk_disable_unprepare(rngc->clk);
> return ret;
> }
Some people think platform_get_irq returning 0 should be handled as
error.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2016-03-01 7:49 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
2016-02-29 23:54 ` Fabio Estevam
2016-03-01 7:49 ` Uwe Kleine-König [this message]
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
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=20160301074937.GU2613@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--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).