From: Fabio Estevam Subject: Re: [PATCH 3/3] hwrng: mxc-fsl - add support for Freescale RNGC Date: Mon, 29 Feb 2016 20:54:19 -0300 Message-ID: References: <1456761156-27664-1-git-send-email-s.trumtrar@pengutronix.de> <1456761156-27664-3-git-send-email-s.trumtrar@pengutronix.de> <20160229213850.GS2613@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Steffen Trumtrar , Mark Rutland , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Herbert Xu , Pawel Moll , Ian Campbell , Kumar Gala , Rob Herring , linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Sascha Hauer , Matt Mackall , Shawn Guo , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Return-path: In-Reply-To: <20160229213850.GS2613-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-crypto.vger.kernel.org On Mon, Feb 29, 2016 at 6:38 PM, Uwe Kleine-K=C3=B6nig 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 >> wrote: >> >> > + ret =3D clk_prepare_enable(rngc->clk); >> > + if (ret) >> > + return ret; >> > + >> > + rngc->irq =3D 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 =3D 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= =2E Or maybe like this: ret =3D 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; } -- To unsubscribe from this list: send the line "unsubscribe devicetree" i= n the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html