All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: Remove unnecessary variables
@ 2015-10-26 17:54 Amitoj Kaur Chawla
  2015-10-26 17:55 ` [PATCH 1/3] staging: rtl8712: " Amitoj Kaur Chawla
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-26 17:54 UTC (permalink / raw)
  To: outreachy-kernel

This patchset removes unnecessary variables that can be replaced with
a single line of code.

The semantic patch used to find this is:

// <smpl>
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;

@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;

@@
type T;
identifier i;
expression E;
@@
- T i = E;
 ... when != i

@@
type T;
identifier i;
@@
- T i;
 ... when != i
// </smpl>

Amitoj Kaur Chawla (3):
  staging: rtl8712: Remove unnecessary variables
  staging: rtl8188eu: Remove unnecessary variables
  staging: sm750fb: sm750: Remove unnecessary variable

 drivers/staging/rtl8188eu/hal/fw.c   |  5 +----
 drivers/staging/rtl8712/rtl871x_mp.c | 10 ++++------
 drivers/staging/sm750fb/sm750.c      |  4 +---
 3 files changed, 6 insertions(+), 13 deletions(-)

-- 
1.9.1



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

* [PATCH 1/3] staging: rtl8712: Remove unnecessary variables
  2015-10-26 17:54 [PATCH 0/3] staging: Remove unnecessary variables Amitoj Kaur Chawla
@ 2015-10-26 17:55 ` Amitoj Kaur Chawla
  2015-10-26 17:57 ` [PATCH 2/3] staging: rtl8188eu: " Amitoj Kaur Chawla
  2015-10-26 17:58 ` [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable Amitoj Kaur Chawla
  2 siblings, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-26 17:55 UTC (permalink / raw)
  To: outreachy-kernel

Remove unnecessary variables that can be replaced with a single line of code.

The semantic patch used to find this is:

// <smpl>
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;

@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;

@@
type T;
identifier i;
expression E;
@@
- T i = E;
 ... when != i

@@
type T;
identifier i;
@@
- T i;
 ... when != i
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_mp.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c
index 00b80f7..8c20aa6 100644
--- a/drivers/staging/rtl8712/rtl871x_mp.c
+++ b/drivers/staging/rtl8712/rtl871x_mp.c
@@ -218,12 +218,11 @@ static u32 bitshift(u32 bitmask)
 
 static u32 get_bb_reg(struct _adapter *pAdapter, u16 offset, u32 bitmask)
 {
-	u32 org_value, bit_shift, new_value;
+	u32 org_value, bit_shift;
 
 	org_value = r8712_bb_reg_read(pAdapter, offset);
 	bit_shift = bitshift(bitmask);
-	new_value = (org_value & bitmask) >> bit_shift;
-	return new_value;
+	return (org_value & bitmask) >> bit_shift;
 }
 
 static u8 set_bb_reg(struct _adapter *pAdapter,
@@ -245,12 +244,11 @@ static u8 set_bb_reg(struct _adapter *pAdapter,
 static u32 get_rf_reg(struct _adapter *pAdapter, u8 path, u8 offset,
 		      u32 bitmask)
 {
-	u32 org_value, bit_shift, new_value;
+	u32 org_value, bit_shift;
 
 	org_value = r8712_rf_reg_read(pAdapter, path, offset);
 	bit_shift = bitshift(bitmask);
-	new_value = (org_value & bitmask) >> bit_shift;
-	return new_value;
+	return (org_value & bitmask) >> bit_shift;
 }
 
 static u8 set_rf_reg(struct _adapter *pAdapter, u8 path, u8 offset, u32 bitmask,
-- 
1.9.1



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

* [PATCH 2/3] staging: rtl8188eu: Remove unnecessary variables
  2015-10-26 17:54 [PATCH 0/3] staging: Remove unnecessary variables Amitoj Kaur Chawla
  2015-10-26 17:55 ` [PATCH 1/3] staging: rtl8712: " Amitoj Kaur Chawla
@ 2015-10-26 17:57 ` Amitoj Kaur Chawla
  2015-10-26 17:58 ` [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable Amitoj Kaur Chawla
  2 siblings, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-26 17:57 UTC (permalink / raw)
  To: outreachy-kernel

Remove unnecessary variable that can be replaced with a single line
of code.

The semantic patch used to find this is:

// <smpl>
@@
expression ret;
@@
- if (ret) return ret;
- return 0;
+ return ret;

@@
local idexpression ret;
expression e;
@@
- ret = e;
- return ret;
+ return e;

@@
type T;
identifier i;
expression E;
@@
- T i = E;
 ... when != i

@@
type T;
identifier i;
@@
- T i;
 ... when != i
// </smpl>


Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/rtl8188eu/hal/fw.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c
index a71c542..23aa6d3 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -190,7 +190,6 @@ int rtl88eu_download_fw(struct adapter *adapt)
 	struct rtl92c_firmware_header *pfwheader = NULL;
 	u8 *pfwdata;
 	u32 fwsize;
-	int err;
 
 	if (request_firmware(&fw, fw_name, device)) {
 		dev_err(device, "Firmware %s not available\n", fw_name);
@@ -229,7 +228,5 @@ int rtl88eu_download_fw(struct adapter *adapt)
 	_rtl88e_write_fw(adapt, pfwdata, fwsize);
 	_rtl88e_enable_fw_download(adapt, false);
 
-	err = _rtl88e_fw_free_to_go(adapt);
-
-	return err;
+	return _rtl88e_fw_free_to_go(adapt);
 }
-- 
1.9.1



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

* [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable
  2015-10-26 17:54 [PATCH 0/3] staging: Remove unnecessary variables Amitoj Kaur Chawla
  2015-10-26 17:55 ` [PATCH 1/3] staging: rtl8712: " Amitoj Kaur Chawla
  2015-10-26 17:57 ` [PATCH 2/3] staging: rtl8188eu: " Amitoj Kaur Chawla
@ 2015-10-26 17:58 ` Amitoj Kaur Chawla
  2015-10-26 17:59   ` Amitoj Kaur Chawla
  2 siblings, 1 reply; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-26 17:58 UTC (permalink / raw)
  To: outreachy-kernel

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 494017f..25a64dd 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1302,7 +1302,6 @@ static struct pci_driver lynxfb_driver = {
 static int __init lynxfb_init(void)
 {
 	char *option;
-	int ret;
 
 #ifdef MODULE
 	option = g_option;
@@ -1312,8 +1311,7 @@ static int __init lynxfb_init(void)
 #endif
 
 	lynxfb_setup(option);
-	ret = pci_register_driver(&lynxfb_driver);
-	return ret;
+	return pci_register_driver(&lynxfb_driver);
 }
 module_init(lynxfb_init);
 
-- 
1.9.1



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

* Re: [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable
  2015-10-26 17:58 ` [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable Amitoj Kaur Chawla
@ 2015-10-26 17:59   ` Amitoj Kaur Chawla
  0 siblings, 0 replies; 5+ messages in thread
From: Amitoj Kaur Chawla @ 2015-10-26 17:59 UTC (permalink / raw)
  To: outreachy-kernel

On Mon, Oct 26, 2015 at 11:28 PM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
>  drivers/staging/sm750fb/sm750.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 494017f..25a64dd 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -1302,7 +1302,6 @@ static struct pci_driver lynxfb_driver = {
>  static int __init lynxfb_init(void)
>  {
>         char *option;
> -       int ret;
>
>  #ifdef MODULE
>         option = g_option;
> @@ -1312,8 +1311,7 @@ static int __init lynxfb_init(void)
>  #endif
>
>         lynxfb_setup(option);
> -       ret = pci_register_driver(&lynxfb_driver);
> -       return ret;
> +       return pci_register_driver(&lynxfb_driver);
>  }
>  module_init(lynxfb_init);
>
> --
> 1.9.1
>

This missed the commit message. Resending. Sorry.

-- 
Amitoj


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

end of thread, other threads:[~2015-10-26 17:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-26 17:54 [PATCH 0/3] staging: Remove unnecessary variables Amitoj Kaur Chawla
2015-10-26 17:55 ` [PATCH 1/3] staging: rtl8712: " Amitoj Kaur Chawla
2015-10-26 17:57 ` [PATCH 2/3] staging: rtl8188eu: " Amitoj Kaur Chawla
2015-10-26 17:58 ` [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable Amitoj Kaur Chawla
2015-10-26 17:59   ` Amitoj Kaur Chawla

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.