linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource()
@ 2016-03-06  1:21 Vladimir Zapolskiy
  2016-03-07 23:27 ` Eric Anholt
  2016-03-16  1:14 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-06  1:21 UTC (permalink / raw)
  To: linux-arm-kernel

The change fixes potential oops while accessing iomem on invalid
address, if devm_ioremap_resource() fails due to some reason.

The devm_ioremap_resource() function returns ERR_PTR() and never
returns NULL, which makes useless a following check for NULL.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Fixes: 5e63dcc74b30 ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates")
---
 drivers/clk/bcm/clk-bcm2835-aux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c
index e4f89e2..3a177ad 100644
--- a/drivers/clk/bcm/clk-bcm2835-aux.c
+++ b/drivers/clk/bcm/clk-bcm2835-aux.c
@@ -38,8 +38,8 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	reg = devm_ioremap_resource(dev, res);
-	if (!reg)
-		return -ENODEV;
+	if (IS_ERR(reg))
+		return PTR_ERR(reg);
 
 	onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL);
 	if (!onecell)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource()
  2016-03-06  1:21 [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource() Vladimir Zapolskiy
@ 2016-03-07 23:27 ` Eric Anholt
  2016-03-16  1:14 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Anholt @ 2016-03-07 23:27 UTC (permalink / raw)
  To: linux-arm-kernel

Vladimir Zapolskiy <vz@mleia.com> writes:

> The change fixes potential oops while accessing iomem on invalid
> address, if devm_ioremap_resource() fails due to some reason.
>
> The devm_ioremap_resource() function returns ERR_PTR() and never
> returns NULL, which makes useless a following check for NULL.
>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Fixes: 5e63dcc74b30 ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates")

Reviewed-by: Eric Anholt <eric@anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160307/8e3b3375/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource()
  2016-03-06  1:21 [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource() Vladimir Zapolskiy
  2016-03-07 23:27 ` Eric Anholt
@ 2016-03-16  1:14 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2016-03-16  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/06, Vladimir Zapolskiy wrote:
> The change fixes potential oops while accessing iomem on invalid
> address, if devm_ioremap_resource() fails due to some reason.
> 
> The devm_ioremap_resource() function returns ERR_PTR() and never
> returns NULL, which makes useless a following check for NULL.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Fixes: 5e63dcc74b30 ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates")
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-16  1:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-06  1:21 [PATCH] clk: bcm2835: fix check of error code returned by devm_ioremap_resource() Vladimir Zapolskiy
2016-03-07 23:27 ` Eric Anholt
2016-03-16  1:14 ` Stephen Boyd

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).