wifi: ath6kl: remove conditional return with no effect
PATCH v2 1/1 wifi: ath6kl: remove conditional return with no effect
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from scripts/coccinelle/misc/cond_return_no_effect.cocci.
---
As suggested by Ping-Ke, the wifi patch of the treewide v1 series [1] is split per driver and posted separately. You can find the Coccinelle script in v1 [1].
---
Changes from v1 [1]
- Split the wifi patch per driver
- Change base to ath/for-next
- Filter only ath6kl changes
[1] https://lore.kernel.org/all/[email protected]/
---
drivers/net/wireless/ath/ath6kl/init.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/wireless/ath/ath6kl/init.c +1 -5
@@ -1566,11 +1566,7 @@ static int ath6kl_init_upload(struct ath6kl *ar) address =MBOX_BASE_ADDRESS +LOCAL_SCRATCH_ADDRESS ; param = options |0x20 ; - status =ath6kl_bmi_reg_write (ar, address, param); -if (status) -return status; - -return status; +return ath6kl_bmi_reg_write (ar, address, param); }int ath6kl_init_hw_params (struct ath6kl *ar)
Signature · 1 line
2.43.0
Quoted 29 lines · Sang-Heon Jeon
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.Signed-off-by Sang-Heon Jeon <[email protected]>---
As suggested by Ping-Ke, the wifi patch of the treewide v1 series [1] is split per driver and posted separately. You can find the Coccinelle script in v1 [1].---
Changes from v1 [1]
- Split the wifi patch per driver
- Change base to ath/for-next
- Filter only ath6kl changes[1] https://lore.kernel.org/all/[email protected]/
---drivers/net/wireless/ath/ath6kl/init.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/net/wireless/ath/ath6kl/init.c +0
-0
drivers/net/wireless/ath/ath6kl/init.c static int ath6kl_init_upload(struct ath6kl *ar) · line 1573
Quoted 8 lines
drivers/net/wireless/ath/ath6kl/init.c +0
-5@@ -1566,11 +1566,7 @@ static int ath6kl_init_upload(struct ath6kl *ar) address =MBOX_BASE_ADDRESS +LOCAL_SCRATCH_ADDRESS ; param = options |0x20 ; - status =ath6kl_bmi_reg_write (ar, address, param); -if (status) -return status; - -return status;
this make the last call inconsistent with the other calls in this function.
my preference would be to change the last line to return 0 instead
Quoted 4 lines
drivers/net/wireless/ath/ath6kl/init.c +1
-0+return ath6kl_bmi_reg_write (ar, address, param); }int ath6kl_init_hw_params (struct ath6kl *ar)
Quoted 42 lines · Jeff Johnson
Quoted 29 lines · Sang-Heon Jeon
Both branches of the check return the same value, so the check has no effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.Signed-off-by Sang-Heon Jeon <[email protected]>---
As suggested by Ping-Ke, the wifi patch of the treewide v1 series [1] is split per driver and posted separately. You can find the Coccinelle script in v1 [1].---
Changes from v1 [1]
- Split the wifi patch per driver
- Change base to ath/for-next
- Filter only ath6kl changes[1] https://lore.kernel.org/all/[email protected]/
---drivers/net/wireless/ath/ath6kl/init.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/net/wireless/ath/ath6kl/init.c +0
-0drivers/net/wireless/ath/ath6kl/init.c static int ath6kl_init_upload(struct ath6kl *ar) · line 1573
Quoted 8 lines
drivers/net/wireless/ath/ath6kl/init.c +0
-5@@ -1566,11 +1566,7 @@ static int ath6kl_init_upload(struct ath6kl *ar) address =MBOX_BASE_ADDRESS +LOCAL_SCRATCH_ADDRESS ; param = options |0x20 ; - status =ath6kl_bmi_reg_write (ar, address, param); -if (status) -return status; - -return status;this make the last call inconsistent with the other calls in this function.
Quoted 1 line
my preference would be to change the last line to return 0 instead
Nice way to get both consistency and explicitness. I'll address it in v3.
Thanks for the review :)
Quoted 5 lines
drivers/net/wireless/ath/ath6kl/init.c static int ath6kl_init_upload(struct ath6kl *ar) · line 1572
Quoted 4 lines
drivers/net/wireless/ath/ath6kl/init.c +1
-0+return ath6kl_bmi_reg_write (ar, address, param); }int ath6kl_init_hw_params (struct ath6kl *ar)
Best Regards,
Sang-Heon Jeon