All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line
@ 2016-10-13  8:41 Mihaela Muraru
  2016-10-13  8:42 ` [Outreachy kernel] " Julia Lawall
  2016-10-13  8:53 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 5+ messages in thread
From: Mihaela Muraru @ 2016-10-13  8:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel

Simplify function returns by merging assignment and return into
one command line.
Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return
        e;
-return ret;

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
---
 ret.out | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 ret.out

diff --git a/ret.out b/ret.out
new file mode 100644
index 0000000..fd4d380
--- /dev/null
+++ b/ret.out
@@ -0,0 +1,22 @@
+--- /home/domino/git/kernels/staging/drivers/staging/rtl8188eu/hal/phy.c
++++ /tmp/cocci-output-5790-5d9d37-phy.c
+@@ -44,8 +44,7 @@ u32 phy_query_bb_reg(struct adapter *ada
+ 
+ 	original_value = usb_read32(adapt, regaddr);
+ 	bit_shift = cal_bit_shift(bitmask);
+-	return_value = (original_value & bitmask) >> bit_shift;
+-	return return_value;
++	return (original_value & bitmask) >> bit_shift;
+ }
+ 
+ void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data)
+@@ -123,8 +122,7 @@ u32 rtw_hal_read_rfreg(struct adapter *a
+ 
+ 	original_value = rf_serial_read(adapt, rf_path, reg_addr);
+ 	bit_shift =  cal_bit_shift(bit_mask);
+-	readback_value = (original_value & bit_mask) >> bit_shift;
+-	return readback_value;
++	return (original_value & bit_mask) >> bit_shift;
+ }
+ 
+ void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line
  2016-10-13  8:41 [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line Mihaela Muraru
@ 2016-10-13  8:42 ` Julia Lawall
  2016-10-13  8:53 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-10-13  8:42 UTC (permalink / raw)
  To: Mihaela Muraru; +Cc: Greg Kroah-Hartman, outreachy-kernel



On Thu, 13 Oct 2016, Mihaela Muraru wrote:

> Simplify function returns by merging assignment and return into
> one command line.
> Found with Coccinelle
> @@
> expression e, ret;
> @@
>
> -ret =
> +return
>         e;
> -return ret;
>
> Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> ---
>  ret.out | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 ret.out
>
> diff --git a/ret.out b/ret.out
> new file mode 100644
> index 0000000..fd4d380
> --- /dev/null
> +++ b/ret.out
> @@ -0,0 +1,22 @@
> +--- /home/domino/git/kernels/staging/drivers/staging/rtl8188eu/hal/phy.c
> ++++ /tmp/cocci-output-5790-5d9d37-phy.c
> +@@ -44,8 +44,7 @@ u32 phy_query_bb_reg(struct adapter *ada
> +
> + 	original_value = usb_read32(adapt, regaddr);
> + 	bit_shift = cal_bit_shift(bitmask);
> +-	return_value = (original_value & bitmask) >> bit_shift;
> +-	return return_value;
> ++	return (original_value & bitmask) >> bit_shift;
> + }

Something went quite wrong here.

julia


> +
> + void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data)
> +@@ -123,8 +122,7 @@ u32 rtw_hal_read_rfreg(struct adapter *a
> +
> + 	original_value = rf_serial_read(adapt, rf_path, reg_addr);
> + 	bit_shift =  cal_bit_shift(bit_mask);
> +-	readback_value = (original_value & bit_mask) >> bit_shift;
> +-	return readback_value;
> ++	return (original_value & bit_mask) >> bit_shift;
> + }
> +
> + void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,
> --
> 2.7.4
>
> --
> 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 post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161013084120.GA6373%40domino-MS-16Y1.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line
  2016-10-13  8:41 [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line Mihaela Muraru
  2016-10-13  8:42 ` [Outreachy kernel] " Julia Lawall
@ 2016-10-13  8:53 ` Greg Kroah-Hartman
  2016-10-13  8:57   ` [Outreachy kernel] " Julia Lawall
  2016-10-13  9:15   ` Muraru Mihaela
  1 sibling, 2 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-13  8:53 UTC (permalink / raw)
  To: Mihaela Muraru; +Cc: outreachy-kernel

On Thu, Oct 13, 2016 at 11:41:20AM +0300, Mihaela Muraru wrote:
> Simplify function returns by merging assignment and return into
> one command line.
> Found with Coccinelle
> @@
> expression e, ret;
> @@
> 
> -ret =
> +return
>         e;
> -return ret;
> 
> Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> ---
>  ret.out | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 ret.out
> 
> diff --git a/ret.out b/ret.out
> new file mode 100644
> index 0000000..fd4d380
> --- /dev/null
> +++ b/ret.out
> @@ -0,0 +1,22 @@
> +--- /home/domino/git/kernels/staging/drivers/staging/rtl8188eu/hal/phy.c
> ++++ /tmp/cocci-output-5790-5d9d37-phy.c
> +@@ -44,8 +44,7 @@ u32 phy_query_bb_reg(struct adapter *ada
> + 
> + 	original_value = usb_read32(adapt, regaddr);
> + 	bit_shift = cal_bit_shift(bitmask);
> +-	return_value = (original_value & bitmask) >> bit_shift;
> +-	return return_value;
> ++	return (original_value & bitmask) >> bit_shift;
> + }
> + 
> + void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data)
> +@@ -123,8 +122,7 @@ u32 rtw_hal_read_rfreg(struct adapter *a
> + 
> + 	original_value = rf_serial_read(adapt, rf_path, reg_addr);
> + 	bit_shift =  cal_bit_shift(bit_mask);
> +-	readback_value = (original_value & bit_mask) >> bit_shift;
> +-	return readback_value;
> ++	return (original_value & bit_mask) >> bit_shift;
> + }
> + 
> + void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,

Your patch just adds a patch to the tree, not what I think you ment to
send here :)

Care to try it again?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Outreachy kernel] Re: [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line
  2016-10-13  8:53 ` Greg Kroah-Hartman
@ 2016-10-13  8:57   ` Julia Lawall
  2016-10-13  9:15   ` Muraru Mihaela
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2016-10-13  8:57 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Mihaela Muraru, outreachy-kernel



On Thu, 13 Oct 2016, Greg Kroah-Hartman wrote:

> On Thu, Oct 13, 2016 at 11:41:20AM +0300, Mihaela Muraru wrote:
> > Simplify function returns by merging assignment and return into
> > one command line.
> > Found with Coccinelle
> > @@
> > expression e, ret;
> > @@
> >
> > -ret =
> > +return
> >         e;
> > -return ret;
> >
> > Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> > ---
> >  ret.out | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 ret.out
> >
> > diff --git a/ret.out b/ret.out
> > new file mode 100644
> > index 0000000..fd4d380
> > --- /dev/null
> > +++ b/ret.out
> > @@ -0,0 +1,22 @@
> > +--- /home/domino/git/kernels/staging/drivers/staging/rtl8188eu/hal/phy.c
> > ++++ /tmp/cocci-output-5790-5d9d37-phy.c
> > +@@ -44,8 +44,7 @@ u32 phy_query_bb_reg(struct adapter *ada
> > +
> > + 	original_value = usb_read32(adapt, regaddr);
> > + 	bit_shift = cal_bit_shift(bitmask);
> > +-	return_value = (original_value & bitmask) >> bit_shift;
> > +-	return return_value;
> > ++	return (original_value & bitmask) >> bit_shift;
> > + }
> > +
> > + void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data)
> > +@@ -123,8 +122,7 @@ u32 rtw_hal_read_rfreg(struct adapter *a
> > +
> > + 	original_value = rf_serial_read(adapt, rf_path, reg_addr);
> > + 	bit_shift =  cal_bit_shift(bit_mask);
> > +-	readback_value = (original_value & bit_mask) >> bit_shift;
> > +-	return readback_value;
> > ++	return (original_value & bit_mask) >> bit_shift;
> > + }
> > +
> > + void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,
>
> Your patch just adds a patch to the tree, not what I think you ment to
> send here :)
>
> Care to try it again?

You should apply the patch generated by Coccinelle, using patch -p1 <
ret.out

julia


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line
  2016-10-13  8:53 ` Greg Kroah-Hartman
  2016-10-13  8:57   ` [Outreachy kernel] " Julia Lawall
@ 2016-10-13  9:15   ` Muraru Mihaela
  1 sibling, 0 replies; 5+ messages in thread
From: Muraru Mihaela @ 2016-10-13  9:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel

On Thu, Oct 13, 2016 at 10:53:49AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Oct 13, 2016 at 11:41:20AM +0300, Mihaela Muraru wrote:
> > Simplify function returns by merging assignment and return into
> > one command line.
> > Found with Coccinelle
> > @@
> > expression e, ret;
> > @@
> > 
> > -ret =
> > +return
> >         e;
> > -return ret;
> > 
> > Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
> > ---
> >  ret.out | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 ret.out
> > 
> > diff --git a/ret.out b/ret.out
> > new file mode 100644
> > index 0000000..fd4d380
> > --- /dev/null
> > +++ b/ret.out
> > @@ -0,0 +1,22 @@
> > +--- /home/domino/git/kernels/staging/drivers/staging/rtl8188eu/hal/phy.c
> > ++++ /tmp/cocci-output-5790-5d9d37-phy.c
> > +@@ -44,8 +44,7 @@ u32 phy_query_bb_reg(struct adapter *ada
> > + 
> > + 	original_value = usb_read32(adapt, regaddr);
> > + 	bit_shift = cal_bit_shift(bitmask);
> > +-	return_value = (original_value & bitmask) >> bit_shift;
> > +-	return return_value;
> > ++	return (original_value & bitmask) >> bit_shift;
> > + }
> > + 
> > + void phy_set_bb_reg(struct adapter *adapt, u32 regaddr, u32 bitmask, u32 data)
> > +@@ -123,8 +122,7 @@ u32 rtw_hal_read_rfreg(struct adapter *a
> > + 
> > + 	original_value = rf_serial_read(adapt, rf_path, reg_addr);
> > + 	bit_shift =  cal_bit_shift(bit_mask);
> > +-	readback_value = (original_value & bit_mask) >> bit_shift;
> > +-	return readback_value;
> > ++	return (original_value & bit_mask) >> bit_shift;
> > + }
> > + 
> > + void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path,
> 
> Your patch just adds a patch to the tree, not what I think you ment to
> send here :)
 
> Care to try it again?

Thanks for reply, i will send it again :)

mihaela
 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-13  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13  8:41 [PATCH] Staging: rtl8188eu: hal: Compress return logic into one line Mihaela Muraru
2016-10-13  8:42 ` [Outreachy kernel] " Julia Lawall
2016-10-13  8:53 ` Greg Kroah-Hartman
2016-10-13  8:57   ` [Outreachy kernel] " Julia Lawall
2016-10-13  9:15   ` Muraru Mihaela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.