* [PATCH] spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable
@ 2015-01-06 13:23 Laurentiu Palcu
2015-01-06 17:02 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Laurentiu Palcu @ 2015-01-06 13:23 UTC (permalink / raw)
To: Mark Brown; +Cc: Julia Lawall, linux-spi, linux-kernel, Laurentiu Palcu
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: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
drivers/spi/spi-dln2.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/spi/spi-dln2.c b/drivers/spi/spi-dln2.c
index cede063..3b7d91d 100644
--- a/drivers/spi/spi-dln2.c
+++ b/drivers/spi/spi-dln2.c
@@ -103,7 +103,6 @@ struct dln2_spi {
*/
static int dln2_spi_enable(struct dln2_spi *dln2, bool enable)
{
- int ret;
u16 cmd;
struct {
u8 port;
@@ -121,11 +120,7 @@ static int dln2_spi_enable(struct dln2_spi *dln2, bool enable)
cmd = DLN2_SPI_DISABLE;
}
- ret = dln2_transfer_tx(dln2->pdev, cmd, &tx, len);
- if (ret < 0)
- return ret;
-
- return 0;
+ return dln2_transfer_tx(dln2->pdev, cmd, &tx, len);
}
/*
@@ -653,11 +648,7 @@ static int dln2_spi_transfer_setup(struct dln2_spi *dln2, u32 speed,
dln2->bpw = bpw;
}
- ret = dln2_spi_enable(dln2, true);
- if (ret < 0)
- return ret;
-
- return 0;
+ return dln2_spi_enable(dln2, true);
}
static int dln2_spi_transfer_one(struct spi_master *master,
@@ -866,7 +857,7 @@ static int dln2_spi_runtime_resume(struct device *dev)
return dln2_spi_enable(dln2, true);
}
-#endif /* CONFIG_PM_RUNTIME */
+#endif /* CONFIG_PM */
static const struct dev_pm_ops dln2_spi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(dln2_spi_suspend, dln2_spi_resume)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable
2015-01-06 13:23 [PATCH] spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable Laurentiu Palcu
@ 2015-01-06 17:02 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-01-06 17:02 UTC (permalink / raw)
To: Laurentiu Palcu; +Cc: Julia Lawall, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
On Tue, Jan 06, 2015 at 03:23:40PM +0200, Laurentiu Palcu wrote:
> 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.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-06 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 13:23 [PATCH] spi/dln2: simplify return flow for dln2_spi_transfer_setup and dln2_spi_enable Laurentiu Palcu
2015-01-06 17:02 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox