]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Fix regression to return zero on success instead of positive value
authorTony Lindgren <tony@atomide.com>
Mon, 11 Nov 2019 19:53:34 +0000 (11:53 -0800)
committerMark Brown <broonie@kernel.org>
Tue, 12 Nov 2019 18:23:51 +0000 (18:23 +0000)
commit84e4f401a633a9514967ee81675a7c8bcc7b2f2e
tree2a37449e726fa96aa530882f7b2fbf72f79ea05e
parent49d822a10dc886d8c93080f99763c163b9b983d7
spi: Fix regression to return zero on success instead of positive value

Commit cff6ba7f50ad ("spi: add power control when set_cs") added generic
runtime PM handling, but also changed the return value to be 1 instead
of 0 that we had earlier as pm_runtime_get functions return a positve
value on success.

This causes SPI devices to return errors for cases where they do:

ret = spi_setup(spi);
if (ret)
return ret;

As in many cases the SPI devices do not check for if (ret < 0).

Let's fix this by setting the status to 0 on succeess after the
runtime PM calls. Let's not return 0 at the end of the function
as this might break again later on if the function changes and
starts returning status again.

Fixes: cff6ba7f50ad ("spi: add power control when set_cs")
Cc: Luhua Xu <luhua.xu@mediatek.com>
Cc: wsd_upstream@mediatek.com
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20191111195334.44833-1-tony@atomide.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c