Skip to content

Commit 14a2042

Browse files
arndbbroonie
authored andcommitted
spi: lp-8841: return correct error code from probe
The spi_lp8841_rtc_probe() function misses an initialization of the return code when it fails to get its memory resource, as gcc notices: drivers/spi/spi-lp8841-rtc.c: In function 'spi_lp8841_rtc_probe': drivers/spi/spi-lp8841-rtc.c:239:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code to propagate the error from devm_ioremap_resource(). Fixes: 7ecbfff ("spi: master driver to enable RTC on ICPDAS LP-8841") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Sergei Ianovich <ynvich@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7ecbfff commit 14a2042

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/spi/spi-lp8841-rtc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
217217
data = spi_master_get_devdata(master);
218218

219219
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
220-
data->iomem = devm_ioremap_resource(&pdev->dev, iomem);
221-
if (IS_ERR(data->iomem)) {
220+
data->iomem = devm_ioremap_resource(&pdev->dev, iomem);
221+
ret = PTR_ERR_OR_ZERO(data->iomem);
222+
if (ret) {
222223
dev_err(&pdev->dev, "failed to get IO address\n");
223224
goto err_put_master;
224225
}

0 commit comments

Comments
 (0)