Commit 9c59fda3 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Linus Walleij

pinctrl: mediatek: pinctrl-moore: Simplify with dev_err_probe()

Use the dev_err_probe() helper to simplify error handling during probe.
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20220308100956.2750295-10-wenst@chromium.orgSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e5fabbe4
...@@ -605,6 +605,7 @@ static int mtk_build_functions(struct mtk_pinctrl *hw) ...@@ -605,6 +605,7 @@ static int mtk_build_functions(struct mtk_pinctrl *hw)
int mtk_moore_pinctrl_probe(struct platform_device *pdev, int mtk_moore_pinctrl_probe(struct platform_device *pdev,
const struct mtk_pin_soc *soc) const struct mtk_pin_soc *soc)
{ {
struct device *dev = &pdev->dev;
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
struct mtk_pinctrl *hw; struct mtk_pinctrl *hw;
int err, i; int err, i;
...@@ -616,11 +617,9 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, ...@@ -616,11 +617,9 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
hw->soc = soc; hw->soc = soc;
hw->dev = &pdev->dev; hw->dev = &pdev->dev;
if (!hw->soc->nbase_names) { if (!hw->soc->nbase_names)
dev_err(&pdev->dev, return dev_err_probe(dev, -EINVAL,
"SoC should be assigned at least one register base\n"); "SoC should be assigned at least one register base\n");
return -EINVAL;
}
hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names,
sizeof(*hw->base), GFP_KERNEL); sizeof(*hw->base), GFP_KERNEL);
...@@ -665,17 +664,13 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, ...@@ -665,17 +664,13 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
/* Setup groups descriptions per SoC types */ /* Setup groups descriptions per SoC types */
err = mtk_build_groups(hw); err = mtk_build_groups(hw);
if (err) { if (err)
dev_err(&pdev->dev, "Failed to build groups\n"); return dev_err_probe(dev, err, "Failed to build groups\n");
return err;
}
/* Setup functions descriptions per SoC types */ /* Setup functions descriptions per SoC types */
err = mtk_build_functions(hw); err = mtk_build_functions(hw);
if (err) { if (err)
dev_err(&pdev->dev, "Failed to build functions\n"); return dev_err_probe(dev, err, "Failed to build functions\n");
return err;
}
/* For able to make pinctrl_claim_hogs, we must not enable pinctrl /* For able to make pinctrl_claim_hogs, we must not enable pinctrl
* until all groups and functions are being added one. * until all groups and functions are being added one.
...@@ -691,10 +686,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev, ...@@ -691,10 +686,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
/* Build gpiochip should be after pinctrl_enable is done */ /* Build gpiochip should be after pinctrl_enable is done */
err = mtk_build_gpiochip(hw); err = mtk_build_gpiochip(hw);
if (err) { if (err)
dev_err(&pdev->dev, "Failed to add gpio_chip\n"); return dev_err_probe(dev, err, "Failed to add gpio_chip\n");
return err;
}
platform_set_drvdata(pdev, hw); platform_set_drvdata(pdev, hw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment