Remove two else-if arms that do nothing.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index 5392d2daf870..4e03eb100175 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -1370,9 +1370,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
}
- } else if ((cur_rf_rssi < tmp_sec_rssi) &&
- (cur_rf_rssi > tmp_min_rssi)) {
- ;
} else if (cur_rf_rssi == tmp_min_rssi) {
if (tmp_sec_rssi == tmp_min_rssi) {
tmp_min_rssi = cur_rf_rssi;
@@ -1426,9 +1423,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
}
- } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) &&
- (cur_cck_pwdb > tmp_cck_min_pwdb)) {
- ;
} else if (cur_cck_pwdb == tmp_cck_min_pwdb) {
if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
tmp_cck_min_pwdb = cur_cck_pwdb;
--
2.45.1
On Sun, May 26, 2024 at 01:19:28PM +0200, Michael Straube wrote:
> Remove two else-if arms that do nothing.
>
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> index 5392d2daf870..4e03eb100175 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
> @@ -1370,9 +1370,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
> tmp_sec_rssi = cur_rf_rssi;
> sec_rssi_index = i;
> }
> - } else if ((cur_rf_rssi < tmp_sec_rssi) &&
> - (cur_rf_rssi > tmp_min_rssi)) {
> - ;
> } else if (cur_rf_rssi == tmp_min_rssi) {
> if (tmp_sec_rssi == tmp_min_rssi) {
> tmp_min_rssi = cur_rf_rssi;
> @@ -1426,9 +1423,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
> tmp_cck_sec_pwdb = cur_cck_pwdb;
> cck_rx_ver2_sec_index = i;
> }
> - } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) &&
> - (cur_cck_pwdb > tmp_cck_min_pwdb)) {
> - ;
> } else if (cur_cck_pwdb == tmp_cck_min_pwdb) {
> if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
> tmp_cck_min_pwdb = cur_cck_pwdb;
I would be careful with these changes. These else-if do prevent the
execution of the other else-if, so the code do not behave the same anymore.
The only case this patch doesn't change anything functionally is when the
condition of the removed if-else is mutually exclusive with the conditions
of the following if-else. Are you sure this is the case?
Best regards,
Nam
Am 26.05.24 um 16:31 schrieb Nam Cao:
> On Sun, May 26, 2024 at 01:19:28PM +0200, Michael Straube wrote:
>> Remove two else-if arms that do nothing.
>>
>> Signed-off-by: Michael Straube <straube.linux@gmail.com>
>> ---
>> drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 6 ------
>> 1 file changed, 6 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> index 5392d2daf870..4e03eb100175 100644
>> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
>> @@ -1370,9 +1370,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
>> tmp_sec_rssi = cur_rf_rssi;
>> sec_rssi_index = i;
>> }
>> - } else if ((cur_rf_rssi < tmp_sec_rssi) &&
>> - (cur_rf_rssi > tmp_min_rssi)) {
>> - ;
>> } else if (cur_rf_rssi == tmp_min_rssi) {
>> if (tmp_sec_rssi == tmp_min_rssi) {
>> tmp_min_rssi = cur_rf_rssi;
>> @@ -1426,9 +1423,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
>> tmp_cck_sec_pwdb = cur_cck_pwdb;
>> cck_rx_ver2_sec_index = i;
>> }
>> - } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) &&
>> - (cur_cck_pwdb > tmp_cck_min_pwdb)) {
>> - ;
>> } else if (cur_cck_pwdb == tmp_cck_min_pwdb) {
>> if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
>> tmp_cck_min_pwdb = cur_cck_pwdb;
>
> I would be careful with these changes. These else-if do prevent the
> execution of the other else-if, so the code do not behave the same anymore.
>
> The only case this patch doesn't change anything functionally is when the
> condition of the removed if-else is mutually exclusive with the conditions
> of the following if-else. Are you sure this is the case?
Ah yes, I had not thought about that. Thanks for pointing out.
I'll have a closer look and resend the series. Either without this patch
or, if it's safe to remove, state it in the commit message.
Thanks,
Michael
This patch doesn't affect behavior at all, but to me the original author wrote the do nothing case for readability, and I don't have a problem with that. In fact, I applaud the author for caring about readability at all which is not a given in staging code. :P regards, dan carpenter
Am 27.05.24 um 09:39 schrieb Dan Carpenter: > This patch doesn't affect behavior at all, but to me the original > author wrote the do nothing case for readability, and I don't have a > problem with that. In fact, I applaud the author for caring about > readability at all which is not a given in staging code. :P Then I think it's better to leave it as is. :) Should I send a v2 with this patched removed or will Greg just apply the first two patches and ignore this one? thanks, Michael
On Mon, May 27, 2024 at 10:34:41AM +0200, Michael Straube wrote: > Am 27.05.24 um 09:39 schrieb Dan Carpenter: > > This patch doesn't affect behavior at all, but to me the original > > author wrote the do nothing case for readability, and I don't have a > > problem with that. In fact, I applaud the author for caring about > > readability at all which is not a given in staging code. :P > > Then I think it's better to leave it as is. :) > Should I send a v2 with this patched removed or will Greg just apply > the first two patches and ignore this one? Resend with Nam's reviewed-by tags. regards, dan carpenter
© 2016 - 2026 Red Hat, Inc.