Skip to contentSkip to conversation

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

PATCH In review Chunyan Zhang 2 participants 2 messages Dec 9, 2020

Subsystems (2)
lore
Share & tools
lore

Chunyan Zhang

author reviewer
#0 lore raw

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

From: Chunyan Zhang <[email protected]>

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")
---
 drivers/gpio/gpio-eic-sprd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-eic-sprd.c +1 -1
index ad61daf6c212..865ab2b34fdd 100644
@@ -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]))
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Chunyan Zhang

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

Patch applied for fixes!

Yours,
Linus Walleij