* [PATCH 1/2] staging: rtlwifi: Remove return variable
2019-03-28 15:07 [PATCH 0/2] staging: rtlwifi: Remove return variable Sanjana Sanikommu
@ 2019-03-28 15:09 ` Sanjana Sanikommu
2019-03-28 15:10 ` [PATCH 2/2] staging: rtlwifi: Remove unused variable Sanjana Sanikommu
2019-03-28 16:35 ` [PATCH v2] staging: rtlwifi: Remove return variable Sanjana Sanikommu
2 siblings, 0 replies; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-28 15:09 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Remove return variable and return "return" value directly. Issue found by
Coccinelle using ret.cocci.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
drivers/staging/rtlwifi/rtl8822be/phy.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index 048904d783fc..aed315143cbb 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -219,10 +219,8 @@ bool rtl8822be_halmac_cb_init_bb_rf_register(struct rtl_priv *rtlpriv)
txpath = RF_MASK_A | RF_MASK_B;
rxpath = RF_MASK_A | RF_MASK_B;
tx2path = false;
- ret = rtlpriv->phydm.ops->phydm_trx_mode(rtlpriv, txpath, rxpath,
+ return rtlpriv->phydm.ops->phydm_trx_mode(rtlpriv, txpath, rxpath,
tx2path);
-
- return ret;
}
static void _rtl8822be_phy_init_tx_power_by_rate(struct ieee80211_hw *hw)
@@ -1580,11 +1578,9 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,
else
tx_num = RF_1TX;
- tx_pwr_diff = (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
+ return (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
[rate] &
0xff);
-
- return tx_pwr_diff;
}
u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
@@ -1858,8 +1854,7 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
offset = -8;
break;
}
- pwrout_dbm = txpwridx / 2 + offset;
- return pwrout_dbm;
+ return txpwridx / 2 + offset;
}
void rtl8822be_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
@@ -2218,6 +2213,5 @@ bool rtl8822be_phy_set_rf_power_state(struct ieee80211_hw *hw,
if (rfpwr_state == ppsc->rfpwr_state)
return bresult;
- bresult = _rtl8822be_phy_set_rf_power_state(hw, rfpwr_state);
- return bresult;
+ return _rtl8822be_phy_set_rf_power_state(hw, rfpwr_state);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: rtlwifi: Remove unused variable.
2019-03-28 15:07 [PATCH 0/2] staging: rtlwifi: Remove return variable Sanjana Sanikommu
2019-03-28 15:09 ` [PATCH 1/2] " Sanjana Sanikommu
@ 2019-03-28 15:10 ` Sanjana Sanikommu
2019-03-28 16:08 ` Greg KH
2019-03-28 16:35 ` [PATCH v2] staging: rtlwifi: Remove return variable Sanjana Sanikommu
2 siblings, 1 reply; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-28 15:10 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Remove unused variable. This variable is
created unnecessarily for return type whose
use is removed using ret.cocci.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
drivers/staging/rtlwifi/rtl8822be/phy.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index aed315143cbb..ececfed7b35a 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -1840,7 +1840,6 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
u8 txpwridx)
{
long offset;
- long pwrout_dbm;
switch (wirelessmode) {
case WIRELESS_MODE_B:
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] staging: rtlwifi: Remove unused variable.
2019-03-28 15:10 ` [PATCH 2/2] staging: rtlwifi: Remove unused variable Sanjana Sanikommu
@ 2019-03-28 16:08 ` Greg KH
2019-03-28 16:15 ` Sanjana Sanikommu
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-03-28 16:08 UTC (permalink / raw)
To: Sanjana Sanikommu; +Cc: outreachy-kernel
On Thu, Mar 28, 2019 at 08:40:07PM +0530, Sanjana Sanikommu wrote:
> Remove unused variable. This variable is
> created unnecessarily for return type whose
> use is removed using ret.cocci.
>
> Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> ---
> drivers/staging/rtlwifi/rtl8822be/phy.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
> index aed315143cbb..ececfed7b35a 100644
> --- a/drivers/staging/rtlwifi/rtl8822be/phy.c
> +++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
> @@ -1840,7 +1840,6 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
> u8 txpwridx)
> {
> long offset;
> - long pwrout_dbm;
Did you just cause this warning to happen with patch 1/2? That's not
ok, please put this together with that patch, you can not have any
commit break the build, or add new build warnings.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] staging: rtlwifi: Remove unused variable.
2019-03-28 16:08 ` Greg KH
@ 2019-03-28 16:15 ` Sanjana Sanikommu
0 siblings, 0 replies; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-28 16:15 UTC (permalink / raw)
To: Greg KH; +Cc: outreachy-kernel
[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]
On Thu, 28 Mar 2019, 21:38 Greg KH, <gregkh@linuxfoundation.org> wrote:
> On Thu, Mar 28, 2019 at 08:40:07PM +0530, Sanjana Sanikommu wrote:
> > Remove unused variable. This variable is
> > created unnecessarily for return type whose
> > use is removed using ret.cocci.
> >
> > Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> > ---
> > drivers/staging/rtlwifi/rtl8822be/phy.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c
> b/drivers/staging/rtlwifi/rtl8822be/phy.c
> > index aed315143cbb..ececfed7b35a 100644
> > --- a/drivers/staging/rtlwifi/rtl8822be/phy.c
> > +++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
> > @@ -1840,7 +1840,6 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct
> ieee80211_hw *hw,
> > u8 txpwridx)
> > {
> > long offset;
> > - long pwrout_dbm;
>
> Did you just cause this warning to happen with patch 1/2? That's not
> ok, please put this together with that patch, you can not have any
> commit break the build, or add new build warnings.
>
I will put them together in one patch and send as v2
Sanjana
>
> thanks,
>
> greg k-h
>
[-- Attachment #2: Type: text/html, Size: 2004 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] staging: rtlwifi: Remove return variable.
2019-03-28 15:07 [PATCH 0/2] staging: rtlwifi: Remove return variable Sanjana Sanikommu
2019-03-28 15:09 ` [PATCH 1/2] " Sanjana Sanikommu
2019-03-28 15:10 ` [PATCH 2/2] staging: rtlwifi: Remove unused variable Sanjana Sanikommu
@ 2019-03-28 16:35 ` Sanjana Sanikommu
2 siblings, 0 replies; 6+ messages in thread
From: Sanjana Sanikommu @ 2019-03-28 16:35 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Remove return variable and return "return" value directly. Issue found by
Coccinelle using ret.cocci.
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
Changes in v2:
Merge 2 patches to one i.e remove unnecessary
variable is merged to [PATCH 1/2].
Remove patch series.
drivers/staging/rtlwifi/rtl8822be/phy.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index 048904d783fc..ececfed7b35a 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -219,10 +219,8 @@ bool rtl8822be_halmac_cb_init_bb_rf_register(struct rtl_priv *rtlpriv)
txpath = RF_MASK_A | RF_MASK_B;
rxpath = RF_MASK_A | RF_MASK_B;
tx2path = false;
- ret = rtlpriv->phydm.ops->phydm_trx_mode(rtlpriv, txpath, rxpath,
+ return rtlpriv->phydm.ops->phydm_trx_mode(rtlpriv, txpath, rxpath,
tx2path);
-
- return ret;
}
static void _rtl8822be_phy_init_tx_power_by_rate(struct ieee80211_hw *hw)
@@ -1580,11 +1578,9 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,
else
tx_num = RF_1TX;
- tx_pwr_diff = (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
+ return (char)(rtlphy->tx_power_by_rate_offset[band][path][tx_num]
[rate] &
0xff);
-
- return tx_pwr_diff;
}
u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
@@ -1844,7 +1840,6 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
u8 txpwridx)
{
long offset;
- long pwrout_dbm;
switch (wirelessmode) {
case WIRELESS_MODE_B:
@@ -1858,8 +1853,7 @@ static long _rtl8822be_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
offset = -8;
break;
}
- pwrout_dbm = txpwridx / 2 + offset;
- return pwrout_dbm;
+ return txpwridx / 2 + offset;
}
void rtl8822be_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
@@ -2218,6 +2212,5 @@ bool rtl8822be_phy_set_rf_power_state(struct ieee80211_hw *hw,
if (rfpwr_state == ppsc->rfpwr_state)
return bresult;
- bresult = _rtl8822be_phy_set_rf_power_state(hw, rfpwr_state);
- return bresult;
+ return _rtl8822be_phy_set_rf_power_state(hw, rfpwr_state);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread