Skip to content

Commit 1e0487c

Browse files
Wang JianzhengSasha Levin
Wang Jianzheng
authored and
Sasha Levin
committed
pinctrl: mvebu: Fix devinit_dove_pinctrl_probe function
[ Upstream commit c254784 ] When an error occurs during the execution of the function __devinit_dove_pinctrl_probe, the clk is not properly disabled. Fix this by calling clk_disable_unprepare before return. Fixes: ba607b6 ("pinctrl: mvebu: make pdma clock on dove mandatory") Signed-off-by: Wang Jianzheng <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f623a88 commit 1e0487c

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

drivers/pinctrl/mvebu/pinctrl-dove.c

+29-13
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
769769
of_match_device(dove_pinctrl_of_match, &pdev->dev);
770770
struct mvebu_mpp_ctrl_data *mpp_data;
771771
void __iomem *base;
772-
int i;
772+
int i, ret;
773773

774774
pdev->dev.platform_data = (void *)match->data;
775775

@@ -785,13 +785,17 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
785785
clk_prepare_enable(clk);
786786

787787
base = devm_platform_get_and_ioremap_resource(pdev, 0, &mpp_res);
788-
if (IS_ERR(base))
789-
return PTR_ERR(base);
788+
if (IS_ERR(base)) {
789+
ret = PTR_ERR(base);
790+
goto err_probe;
791+
}
790792

791793
mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols,
792794
sizeof(*mpp_data), GFP_KERNEL);
793-
if (!mpp_data)
794-
return -ENOMEM;
795+
if (!mpp_data) {
796+
ret = -ENOMEM;
797+
goto err_probe;
798+
}
795799

796800
dove_pinctrl_info.control_data = mpp_data;
797801
for (i = 0; i < ARRAY_SIZE(dove_mpp_controls); i++)
@@ -810,8 +814,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
810814
}
811815

812816
mpp4_base = devm_ioremap_resource(&pdev->dev, res);
813-
if (IS_ERR(mpp4_base))
814-
return PTR_ERR(mpp4_base);
817+
if (IS_ERR(mpp4_base)) {
818+
ret = PTR_ERR(mpp4_base);
819+
goto err_probe;
820+
}
815821

816822
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
817823
if (!res) {
@@ -822,8 +828,10 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
822828
}
823829

824830
pmu_base = devm_ioremap_resource(&pdev->dev, res);
825-
if (IS_ERR(pmu_base))
826-
return PTR_ERR(pmu_base);
831+
if (IS_ERR(pmu_base)) {
832+
ret = PTR_ERR(pmu_base);
833+
goto err_probe;
834+
}
827835

828836
gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config");
829837
if (IS_ERR(gconfmap)) {
@@ -833,19 +841,27 @@ static int dove_pinctrl_probe(struct platform_device *pdev)
833841
adjust_resource(&fb_res,
834842
(mpp_res->start & INT_REGS_MASK) + GC_REGS_OFFS, 0x14);
835843
gc_base = devm_ioremap_resource(&pdev->dev, &fb_res);
836-
if (IS_ERR(gc_base))
837-
return PTR_ERR(gc_base);
844+
if (IS_ERR(gc_base)) {
845+
ret = PTR_ERR(gc_base);
846+
goto err_probe;
847+
}
848+
838849
gconfmap = devm_regmap_init_mmio(&pdev->dev,
839850
gc_base, &gc_regmap_config);
840-
if (IS_ERR(gconfmap))
841-
return PTR_ERR(gconfmap);
851+
if (IS_ERR(gconfmap)) {
852+
ret = PTR_ERR(gconfmap);
853+
goto err_probe;
854+
}
842855
}
843856

844857
/* Warn on any missing DT resource */
845858
if (fb_res.start)
846859
dev_warn(&pdev->dev, FW_BUG "Missing pinctrl regs in DTB. Please update your firmware.\n");
847860

848861
return mvebu_pinctrl_probe(pdev);
862+
err_probe:
863+
clk_disable_unprepare(clk);
864+
return ret;
849865
}
850866

851867
static struct platform_driver dove_pinctrl_driver = {

0 commit comments

Comments
 (0)