Skip to content

Commit cd94896

Browse files
Shuai Jiangwsakernel
authored andcommitted
i2c: qup: Add missing unwind goto in qup_i2c_probe()
Smatch Warns: drivers/i2c/busses/i2c-qup.c:1784 qup_i2c_probe() warn: missing unwind goto? The goto label "fail_runtime" and "fail" will disable qup->pclk, but here qup->pclk failed to obtain, in order to be consistent, change the direct return to goto label "fail_dma". Fixes: 9cedf3b ("i2c: qup: Add bam dma capabilities") Signed-off-by: Shuai Jiang <d202180596@hust.edu.cn> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org> Cc: <stable@vger.kernel.org> # v4.6+
1 parent bd5c710 commit cd94896

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

drivers/i2c/busses/i2c-qup.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,16 +1752,21 @@ static int qup_i2c_probe(struct platform_device *pdev)
17521752
if (!clk_freq || clk_freq > I2C_MAX_FAST_MODE_PLUS_FREQ) {
17531753
dev_err(qup->dev, "clock frequency not supported %d\n",
17541754
clk_freq);
1755-
return -EINVAL;
1755+
ret = -EINVAL;
1756+
goto fail_dma;
17561757
}
17571758

17581759
qup->base = devm_platform_ioremap_resource(pdev, 0);
1759-
if (IS_ERR(qup->base))
1760-
return PTR_ERR(qup->base);
1760+
if (IS_ERR(qup->base)) {
1761+
ret = PTR_ERR(qup->base);
1762+
goto fail_dma;
1763+
}
17611764

17621765
qup->irq = platform_get_irq(pdev, 0);
1763-
if (qup->irq < 0)
1764-
return qup->irq;
1766+
if (qup->irq < 0) {
1767+
ret = qup->irq;
1768+
goto fail_dma;
1769+
}
17651770

17661771
if (has_acpi_companion(qup->dev)) {
17671772
ret = device_property_read_u32(qup->dev,
@@ -1775,13 +1780,15 @@ static int qup_i2c_probe(struct platform_device *pdev)
17751780
qup->clk = devm_clk_get(qup->dev, "core");
17761781
if (IS_ERR(qup->clk)) {
17771782
dev_err(qup->dev, "Could not get core clock\n");
1778-
return PTR_ERR(qup->clk);
1783+
ret = PTR_ERR(qup->clk);
1784+
goto fail_dma;
17791785
}
17801786

17811787
qup->pclk = devm_clk_get(qup->dev, "iface");
17821788
if (IS_ERR(qup->pclk)) {
17831789
dev_err(qup->dev, "Could not get iface clock\n");
1784-
return PTR_ERR(qup->pclk);
1790+
ret = PTR_ERR(qup->pclk);
1791+
goto fail_dma;
17851792
}
17861793
qup_i2c_enable_clocks(qup);
17871794
src_clk_freq = clk_get_rate(qup->clk);

0 commit comments

Comments
 (0)