Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>
Link: https://lore.kernel.org/r/20201209055106.840100-1-zhang.lyra@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Chunyan Zhang and committed by
Linus Walleij
263ade71 77c12bf3

+1 -1
+1 -1
drivers/gpio/gpio-eic-sprd.c
··· 598 598 */ 599 599 res = platform_get_resource(pdev, IORESOURCE_MEM, i); 600 600 if (!res) 601 - continue; 601 + break; 602 602 603 603 sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res); 604 604 if (IS_ERR(sprd_eic->base[i]))