mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
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: 7ecbfff671
("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>
This commit is contained in:
parent
7ecbfff671
commit
14a20428e2
@ -217,8 +217,9 @@ spi_lp8841_rtc_probe(struct platform_device *pdev)
|
|||||||
data = spi_master_get_devdata(master);
|
data = spi_master_get_devdata(master);
|
||||||
|
|
||||||
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
data->iomem = devm_ioremap_resource(&pdev->dev, iomem);
|
data->iomem = devm_ioremap_resource(&pdev->dev, iomem);
|
||||||
if (IS_ERR(data->iomem)) {
|
ret = PTR_ERR_OR_ZERO(data->iomem);
|
||||||
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "failed to get IO address\n");
|
dev_err(&pdev->dev, "failed to get IO address\n");
|
||||||
goto err_put_master;
|
goto err_put_master;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user