All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource()
@ 2021-06-10  9:17 Yang Yingliang
  2021-06-10 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-06-10  9:17 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: davem, kuba, andrew

Use devm_platform_get_and_ioremap_resource() to simplify
code and avoid a null-ptr-deref by checking 'res' in it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/mdio/mdio-mux-bcm-iproc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mdio/mdio-mux-bcm-iproc.c b/drivers/net/mdio/mdio-mux-bcm-iproc.c
index 239e88c7a272..014c0baedbd2 100644
--- a/drivers/net/mdio/mdio-mux-bcm-iproc.c
+++ b/drivers/net/mdio/mdio-mux-bcm-iproc.c
@@ -187,7 +187,9 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	md->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	md->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(md->base))
+		return PTR_ERR(md->base);
 	if (res->start & 0xfff) {
 		/* For backward compatibility in case the
 		 * base address is specified with an offset.
@@ -196,9 +198,6 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
 		res->start &= ~0xfff;
 		res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
 	}
-	md->base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(md->base))
-		return PTR_ERR(md->base);
 
 	md->mii_bus = devm_mdiobus_alloc(&pdev->dev);
 	if (!md->mii_bus) {
-- 
2.25.1


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

* Re: [PATCH net-next] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource()
  2021-06-10  9:17 [PATCH net-next] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
@ 2021-06-10 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-10 21:10 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, netdev, davem, kuba, andrew

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 10 Jun 2021 17:17:12 +0800 you wrote:
> Use devm_platform_get_and_ioremap_resource() to simplify
> code and avoid a null-ptr-deref by checking 'res' in it.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/mdio/mdio-mux-bcm-iproc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [net-next] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource()
    https://git.kernel.org/netdev/net-next/c/8a55a73433e7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-06-10 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  9:17 [PATCH net-next] net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
2021-06-10 21:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.