diff mbox series

gpio: eic-sprd: break loop when getting NULL device resource

Message ID 20201209055106.840100-1-zhang.lyra@gmail.com
State New
Headers show
Series gpio: eic-sprd: break loop when getting NULL device resource | expand

Commit Message

Chunyan Zhang Dec. 9, 2020, 5:51 a.m. UTC
From: Chunyan Zhang <chunyan.zhang@unisoc.com>

EIC controller have unfixed numbers of banks on different Spreadtrum SoCs,
and each bank has its own base address, the loop of getting there base
address in driver should break if the resource gotten via
platform_get_resource() is NULL already. The later ones would be all NULL
even if the loop continues.

Fixes: 25518e024e3a ("gpio: Add Spreadtrum EIC driver support")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
---
 drivers/gpio/gpio-eic-sprd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Dec. 9, 2020, 8:42 a.m. UTC | #1
On Wed, Dec 9, 2020 at 6:51 AM Chunyan Zhang <zhang.lyra@gmail.com> wrote:

> EIC controller have unfixed numbers of banks on different Spreadtrum SoCs,
> and each bank has its own base address, the loop of getting there base
> address in driver should break if the resource gotten via
> platform_get_resource() is NULL already. The later ones would be all NULL
> even if the loop continues.
>
> Fixes: 25518e024e3a ("gpio: Add Spreadtrum EIC driver support")
> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>

Patch applied for fixes!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index ad61daf6c212..865ab2b34fdd 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -598,7 +598,7 @@  static int sprd_eic_probe(struct platform_device *pdev)
 		 */
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
-			continue;
+			break;
 
 		sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
 		if (IS_ERR(sprd_eic->base[i]))