staging: Remove unnecessary variables
Subsystems (2)
cover staging: Remove unnecessary variables
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(-)
Signature · 1 line
1.9.1
PATCH 1/3 staging: rtl8712: Remove unnecessary variables
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>
--- drivers/staging/rtl8712/rtl871x_mp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/rtl871x_mp.c +4 -6
@@ -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,
Signature · 1 line
1.9.1
PATCH 2/3 staging: rtl8188eu: Remove unnecessary variables
In reply to Amitoj Kaur ChawlaRemove 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>
--- drivers/staging/rtl8188eu/hal/fw.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8188eu/hal/fw.c +1 -4
@@ -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); }
Signature · 1 line
1.9.1
PATCH 3/3 staging: sm750fb: sm750: Remove unnecessary variable
In reply to Amitoj Kaur Chawla--- drivers/staging/sm750fb/sm750.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/sm750fb/sm750.c +1 -3
@@ -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);
Signature · 1 line
1.9.1
Re: [PATCH 3/3] staging: sm750fb: sm750: Remove unnecessary variable
Quoted 28 lines · Amitoj Kaur Chawla
Signed-off-by Amitoj Kaur Chawla <[email protected]>--- drivers/staging/sm750fb/sm750.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/sm750fb/sm750.c +1
-4@@ -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); --
Quoted 2 lines
1.9.1
This missed the commit message. Resending. Sorry.
Signature · 1 line
Amitoj