* [PATCH] staging: kpc2000: Remove unnecessary return variable
@ 2019-10-09 17:07 Wambui Karuga
2019-10-09 18:55 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Wambui Karuga @ 2019-10-09 17:07 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, devel, linux-kernel
Remove unnecessary variable `val` in kp_spi_read_reg() that only holds
the return value from readq().
Issue found by coccinelle using the script:
@@
local idexpression ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
---
drivers/staging/kpc2000/kpc2000_spi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 3be33c450cab..6ba94b0131da 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -162,14 +162,12 @@ union kp_spi_ffctrl {
kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
{
u64 __iomem *addr = cs->base;
- u64 val;
addr += idx;
if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0))
return cs->conf_cache;
- val = readq(addr);
- return val;
+ return readq(addr);
}
static inline void
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: kpc2000: Remove unnecessary return variable
2019-10-09 17:07 [PATCH] staging: kpc2000: Remove unnecessary return variable Wambui Karuga
@ 2019-10-09 18:55 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2019-10-09 18:55 UTC (permalink / raw)
To: Wambui Karuga; +Cc: outreachy-kernel, gregkh, devel, linux-kernel
On Wed, 9 Oct 2019, Wambui Karuga wrote:
> Remove unnecessary variable `val` in kp_spi_read_reg() that only holds
> the return value from readq().
> Issue found by coccinelle using the script:
>
> @@
> local idexpression ret;
> expression e;
> @@
>
> -ret =
> +return
> e;
> -return ret;
>
> Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
> drivers/staging/kpc2000/kpc2000_spi.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
> index 3be33c450cab..6ba94b0131da 100644
> --- a/drivers/staging/kpc2000/kpc2000_spi.c
> +++ b/drivers/staging/kpc2000/kpc2000_spi.c
> @@ -162,14 +162,12 @@ union kp_spi_ffctrl {
> kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
> {
> u64 __iomem *addr = cs->base;
> - u64 val;
>
> addr += idx;
> if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0))
> return cs->conf_cache;
>
> - val = readq(addr);
> - return val;
> + return readq(addr);
> }
>
> static inline void
> --
> 2.23.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191009170703.GA2869%40wambui.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-09 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 17:07 [PATCH] staging: kpc2000: Remove unnecessary return variable Wambui Karuga
2019-10-09 18:55 ` [Outreachy kernel] " Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).