summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-brcmstb.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-08-13 14:42:55 +0200
committerLinus Walleij <linus.walleij@linaro.org>2015-08-13 14:42:55 +0200
commit5f6f02cd49d61e9856ff2c337578316a1a1b3f88 (patch)
treefd2e6961e8f609af41dd4a282008e1bc52cfa7c7 /drivers/gpio/gpio-brcmstb.c
parent3afa129a9de0957d72165cf08a54e5c69938011c (diff)
parentcbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f (diff)
downloadlinux-5f6f02cd49d61e9856ff2c337578316a1a1b3f88.tar.bz2
Merge tag 'v4.2-rc4' into devel
Linux 4.2-rc4
Diffstat (limited to 'drivers/gpio/gpio-brcmstb.c')
-rw-r--r--drivers/gpio/gpio-brcmstb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 113dc07fbfbe..9ea86d2ac054 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -292,6 +292,15 @@ static int brcmstb_gpio_remove(struct platform_device *pdev)
struct brcmstb_gpio_bank *bank;
int ret = 0;
+ if (!priv) {
+ dev_err(&pdev->dev, "called %s without drvdata!\n", __func__);
+ return -EFAULT;
+ }
+
+ /*
+ * You can lose return values below, but we report all errors, and it's
+ * more important to actually perform all of the steps.
+ */
list_for_each(pos, &priv->bank_list) {
bank = list_entry(pos, struct brcmstb_gpio_bank, node);
ret = bgpio_remove(&bank->bgc);
@@ -414,6 +423,8 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
+ platform_set_drvdata(pdev, priv);
+ INIT_LIST_HEAD(&priv->bank_list);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg_base = devm_ioremap_resource(dev, res);
@@ -434,7 +445,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
priv->parent_irq = -ENOENT;
}
- INIT_LIST_HEAD(&priv->bank_list);
if (brcmstb_gpio_sanity_check_banks(dev, np, res))
return -EINVAL;
@@ -515,8 +525,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n",
num_banks, priv->gpio_base, gpio_base - 1);
- platform_set_drvdata(pdev, priv);
-
return 0;
fail: