* [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error
@ 2014-10-30 9:21 Pramod Gurav
2014-10-31 21:11 ` Linus Walleij
2014-11-03 16:05 ` Lee Jones
0 siblings, 2 replies; 4+ messages in thread
From: Pramod Gurav @ 2014-10-30 9:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Pramod Gurav, Linus Walleij, Samuel Ortiz, Lee Jones
Error check around return value of devm_ioremap is missing. Add the same
to avoid NULL pointer dereference.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
drivers/mfd/db8500-prcmu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 193cf16..89ae8bf 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -3167,6 +3167,11 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
}
tcdm_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
+ if (!tcdm_base) {
+ dev_err(&pdev->dev,
+ "failed to ioremap prcmu-tcdm register memory\n");
+ return -ENOENT;
+ }
/* Clean up the mailbox interrupts after pre-kernel code. */
writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error
2014-10-30 9:21 [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error Pramod Gurav
@ 2014-10-31 21:11 ` Linus Walleij
2014-11-03 16:05 ` Lee Jones
1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-10-31 21:11 UTC (permalink / raw)
To: Pramod Gurav; +Cc: linux-kernel@vger.kernel.org, Samuel Ortiz, Lee Jones
On Thu, Oct 30, 2014 at 10:21 AM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:
> Error check around return value of devm_ioremap is missing. Add the same
> to avoid NULL pointer dereference.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error
2014-10-30 9:21 [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error Pramod Gurav
2014-10-31 21:11 ` Linus Walleij
@ 2014-11-03 16:05 ` Lee Jones
2014-11-03 16:45 ` Lee Jones
1 sibling, 1 reply; 4+ messages in thread
From: Lee Jones @ 2014-11-03 16:05 UTC (permalink / raw)
To: Pramod Gurav; +Cc: linux-kernel, Linus Walleij, Samuel Ortiz
On Thu, 30 Oct 2014, Pramod Gurav wrote:
> Error check around return value of devm_ioremap is missing. Add the same
> to avoid NULL pointer dereference.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
> drivers/mfd/db8500-prcmu.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
> index 193cf16..89ae8bf 100644
> --- a/drivers/mfd/db8500-prcmu.c
> +++ b/drivers/mfd/db8500-prcmu.c
> @@ -3167,6 +3167,11 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
> }
> tcdm_base = devm_ioremap(&pdev->dev, res->start,
> resource_size(res));
> + if (!tcdm_base) {
> + dev_err(&pdev->dev,
> + "failed to ioremap prcmu-tcdm register memory\n");
> + return -ENOENT;
No such file or directory? I think not.
Changed to -ENOMEM and applied with Linus' Ack.
> + }
>
> /* Clean up the mailbox interrupts after pre-kernel code. */
> writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error
2014-11-03 16:05 ` Lee Jones
@ 2014-11-03 16:45 ` Lee Jones
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2014-11-03 16:45 UTC (permalink / raw)
To: Pramod Gurav; +Cc: linux-kernel, Linus Walleij, Samuel Ortiz
On Mon, 03 Nov 2014, Lee Jones wrote:
> On Thu, 30 Oct 2014, Pramod Gurav wrote:
>
> > Error check around return value of devm_ioremap is missing. Add the same
> > to avoid NULL pointer dereference.
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> > ---
> > drivers/mfd/db8500-prcmu.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
> > index 193cf16..89ae8bf 100644
> > --- a/drivers/mfd/db8500-prcmu.c
> > +++ b/drivers/mfd/db8500-prcmu.c
> > @@ -3167,6 +3167,11 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
> > }
> > tcdm_base = devm_ioremap(&pdev->dev, res->start,
> > resource_size(res));
> > + if (!tcdm_base) {
> > + dev_err(&pdev->dev,
> > + "failed to ioremap prcmu-tcdm register memory\n");
> > + return -ENOENT;
>
> No such file or directory? I think not.
>
> Changed to -ENOMEM and applied with Linus' Ack.
Slight change of plan, as it looks like all of the return paths were
bogus. Patch sent instead.
> > + }
> >
> > /* Clean up the mailbox interrupts after pre-kernel code. */
> > writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-03 16:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 9:21 [PATCH] mfd: db8500-prcmu: check return of devm_ioremap for error Pramod Gurav
2014-10-31 21:11 ` Linus Walleij
2014-11-03 16:05 ` Lee Jones
2014-11-03 16:45 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox