]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
gpio: eic-sprd: break loop when getting NULL device resource
authorChunyan Zhang <chunyan.zhang@unisoc.com>
Wed, 9 Dec 2020 05:51:06 +0000 (13:51 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Jan 2021 13:25:24 +0000 (14:25 +0100)
BugLink: https://bugs.launchpad.net/bugs/1910822
[ Upstream commit 263ade7166a2e589c5b605272690c155c0637dcb ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/gpio/gpio-eic-sprd.c

index 8c97577740100914242bbf5cdc56aca8ca61163a..a69b3faf51ef047978ced8a7f4c8e870c0bd5cc9 100644 (file)
@@ -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]))