Commit 2b5e368e authored by Laurentiu Palcu's avatar Laurentiu Palcu Committed by Mark Brown

spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable

This fixes the following kbuild test robot warnings:

>> drivers/spi/spi-dln2.c:124:1-4: WARNING: end returns can be simplified if negative or 0 value
>> drivers/spi/spi-dln2.c:656:1-4: WARNING: end returns can be simplified if negative or 0 value

Additionally, fix a comment after switching from CONFIG_PM_RUNTIME to
CONFIG_PM.
Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarLaurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b2e5dda1
...@@ -103,7 +103,6 @@ struct dln2_spi { ...@@ -103,7 +103,6 @@ struct dln2_spi {
*/ */
static int dln2_spi_enable(struct dln2_spi *dln2, bool enable) static int dln2_spi_enable(struct dln2_spi *dln2, bool enable)
{ {
int ret;
u16 cmd; u16 cmd;
struct { struct {
u8 port; u8 port;
...@@ -121,11 +120,7 @@ static int dln2_spi_enable(struct dln2_spi *dln2, bool enable) ...@@ -121,11 +120,7 @@ static int dln2_spi_enable(struct dln2_spi *dln2, bool enable)
cmd = DLN2_SPI_DISABLE; cmd = DLN2_SPI_DISABLE;
} }
ret = dln2_transfer_tx(dln2->pdev, cmd, &tx, len); return dln2_transfer_tx(dln2->pdev, cmd, &tx, len);
if (ret < 0)
return ret;
return 0;
} }
/* /*
...@@ -653,11 +648,7 @@ static int dln2_spi_transfer_setup(struct dln2_spi *dln2, u32 speed, ...@@ -653,11 +648,7 @@ static int dln2_spi_transfer_setup(struct dln2_spi *dln2, u32 speed,
dln2->bpw = bpw; dln2->bpw = bpw;
} }
ret = dln2_spi_enable(dln2, true); return dln2_spi_enable(dln2, true);
if (ret < 0)
return ret;
return 0;
} }
static int dln2_spi_transfer_one(struct spi_master *master, static int dln2_spi_transfer_one(struct spi_master *master,
...@@ -866,7 +857,7 @@ static int dln2_spi_runtime_resume(struct device *dev) ...@@ -866,7 +857,7 @@ static int dln2_spi_runtime_resume(struct device *dev)
return dln2_spi_enable(dln2, true); return dln2_spi_enable(dln2, true);
} }
#endif /* CONFIG_PM_RUNTIME */ #endif /* CONFIG_PM */
static const struct dev_pm_ops dln2_spi_pm = { static const struct dev_pm_ops dln2_spi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(dln2_spi_suspend, dln2_spi_resume) SET_SYSTEM_SLEEP_PM_OPS(dln2_spi_suspend, dln2_spi_resume)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment