public inbox for linux-mips@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] MIPS: OCTEON: octeon-usb: Use devm_platform_get_and_ioremap_resource()
@ 2021-06-05  7:55 Yang Yingliang
  2021-06-21  9:44 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-06-05  7:55 UTC (permalink / raw)
  To: linux-kernel, linux-mips; +Cc: tsbogend

Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

And use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 arch/mips/cavium-octeon/octeon-usb.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c
index 950e6c6e8629..6e4d3619137a 100644
--- a/arch/mips/cavium-octeon/octeon-usb.c
+++ b/arch/mips/cavium-octeon/octeon-usb.c
@@ -516,20 +516,13 @@ static int __init dwc3_octeon_device_init(void)
 			if (!pdev)
 				return -ENODEV;
 
-			res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-			if (res == NULL) {
-				put_device(&pdev->dev);
-				dev_err(&pdev->dev, "No memory resources\n");
-				return -ENXIO;
-			}
-
 			/*
 			 * The code below maps in the registers necessary for
 			 * setting up the clocks and reseting PHYs. We must
 			 * release the resources so the dwc3 subsystem doesn't
 			 * know the difference.
 			 */
-			base = devm_ioremap_resource(&pdev->dev, res);
+			base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 			if (IS_ERR(base)) {
 				put_device(&pdev->dev);
 				return PTR_ERR(base);
-- 
2.25.1


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

* Re: [PATCH -next] MIPS: OCTEON: octeon-usb: Use devm_platform_get_and_ioremap_resource()
  2021-06-05  7:55 [PATCH -next] MIPS: OCTEON: octeon-usb: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
@ 2021-06-21  9:44 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-06-21  9:44 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-mips

On Sat, Jun 05, 2021 at 03:55:37PM +0800, Yang Yingliang wrote:
> Remove unneeded error handling on the result of a call
> to platform_get_resource() when the value is passed to
> devm_ioremap_resource().
> 
> And use devm_platform_get_and_ioremap_resource() to simplify
> code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  arch/mips/cavium-octeon/octeon-usb.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-05  7:55 [PATCH -next] MIPS: OCTEON: octeon-usb: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
2021-06-21  9:44 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox