* [PATCH 00/24] remove unused variables
@ 2015-02-27 12:48 Aya Mahfouz
2015-02-27 12:49 ` [PATCH 01/24] staging: wlan-ng: remove unused variable Aya Mahfouz
` (23 more replies)
0 siblings, 24 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:48 UTC (permalink / raw)
To: outreachy-kernel
This patchset is concerned with removing variables that were used only
once to store the value of a function and then return it. The following
coccinelle script was used to discover the pattern and resolve it:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Aya Mahfouz (24):
staging: wlan-ng: remove unused variable
staging: wlan-ng: remove unused variable
staging: vt6655: remove unused variable
staging: rtl8188eu: os_dep: remove unused variable
staging: rtl8188eu: os_dep: remove unused variable
staging: lustre: ptlrpc: remove unused variable
staging: lustre: osc: remove unused variable
staging: lustre: obdecho: remove unused variable
staging: lustre: obdclass: remove unused variable
staging: lustre: obdclass: remove unused variable
staging: lustre: mgc: remove unused variable
staging: wlan-ng: remove unused variable
staging: lustre: mdc: remove unused variable
staging: lustre: lov: remove unused variable
staging: lustre: lmv: remove unused variables
staging: lustre: llite: remove unused variable
staging: lustre: llite: remove unused variable
staging: lustre: llite: remove unused variable
staging: lustre: llite: remove unused variable
staging: iio: meter: remove unused variable
staging: iio: meter: remove unused variables
staging: iio: light: remove unused variable
staging: fbtft: remove unused variable
staging: dgap: remove unused variable
drivers/staging/dgap/dgap.c | 5 +----
drivers/staging/fbtft/fbtft-core.c | 4 +---
drivers/staging/iio/light/tsl2583.c | 4 +---
drivers/staging/iio/meter/ade7758_core.c | 10 ++--------
drivers/staging/iio/meter/ade7759.c | 5 +----
drivers/staging/lustre/lustre/llite/dcache.c | 5 +----
drivers/staging/lustre/lustre/llite/file.c | 4 +---
drivers/staging/lustre/lustre/llite/lproc_llite.c | 5 +----
drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +----
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 ++------
drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++---
drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +---
drivers/staging/lustre/lustre/mdc/mdc_request.c | 4 +---
drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +----
drivers/staging/lustre/lustre/obdclass/dt_object.c | 5 +----
drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +-----
drivers/staging/lustre/lustre/obdecho/echo_client.c | 5 +----
drivers/staging/lustre/lustre/osc/lproc_osc.c | 5 +----
drivers/staging/lustre/lustre/ptlrpc/nrs.c | 5 +----
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 +---
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 16 +++-------------
drivers/staging/vt6655/rxtx.c | 6 +-----
drivers/staging/wlan-ng/prism2mib.c | 11 ++---------
drivers/staging/wlan-ng/prism2sta.c | 5 +----
24 files changed, 30 insertions(+), 111 deletions(-)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH 01/24] staging: wlan-ng: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
@ 2015-02-27 12:49 ` Aya Mahfouz
2015-02-27 12:50 ` [PATCH 02/24] " Aya Mahfouz
` (22 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:49 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/wlan-ng/prism2sta.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 10ad24a..77e0f89 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -243,7 +243,6 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
struct p80211_metawep *p80211_wep)
{
hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
- int result;
/* If necessary, set the 802.11 WEP bit */
if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
@@ -251,9 +250,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
}
- result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
-
- return result;
+ return hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
}
/*----------------------------------------------------------------
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 02/24] staging: wlan-ng: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
2015-02-27 12:49 ` [PATCH 01/24] staging: wlan-ng: remove unused variable Aya Mahfouz
@ 2015-02-27 12:50 ` Aya Mahfouz
2015-02-27 12:51 ` [PATCH 03/24] staging: vt6655: " Aya Mahfouz
` (21 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:50 UTC (permalink / raw)
To: outreachy-kernel
This patch removes variables that were simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/wlan-ng/prism2mib.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c
index 0163e06..b4a15ef 100644
--- a/drivers/staging/wlan-ng/prism2mib.c
+++ b/drivers/staging/wlan-ng/prism2mib.c
@@ -582,8 +582,6 @@ static int prism2mib_privacyinvoked(struct mibrec *mib,
struct p80211msg_dot11req_mibset *msg,
void *data)
{
- int result;
-
if (wlandev->hostwep & HOSTWEP_DECRYPT) {
if (wlandev->hostwep & HOSTWEP_DECRYPT)
mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
@@ -591,9 +589,7 @@ static int prism2mib_privacyinvoked(struct mibrec *mib,
mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT;
}
- result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
-
- return result;
+ return prism2mib_flag(mib, isget, wlandev, hw, msg, data);
}
/*----------------------------------------------------------------
@@ -628,11 +624,8 @@ static int prism2mib_excludeunencrypted(struct mibrec *mib,
struct p80211msg_dot11req_mibset *msg,
void *data)
{
- int result;
-
- result = prism2mib_flag(mib, isget, wlandev, hw, msg, data);
- return result;
+ return prism2mib_flag(mib, isget, wlandev, hw, msg, data);
}
/*----------------------------------------------------------------
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 03/24] staging: vt6655: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
2015-02-27 12:49 ` [PATCH 01/24] staging: wlan-ng: remove unused variable Aya Mahfouz
2015-02-27 12:50 ` [PATCH 02/24] " Aya Mahfouz
@ 2015-02-27 12:51 ` Aya Mahfouz
2015-02-27 12:53 ` [PATCH 04/24] staging: rtl8188eu: os_dep: " Aya Mahfouz
` (20 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:51 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/vt6655/rxtx.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 07ce3fd..ac8c8b5 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1505,8 +1505,6 @@ int vnt_beacon_make(struct vnt_private *priv, struct ieee80211_vif *vif)
int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *conf)
{
- int ret;
-
VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
@@ -1515,7 +1513,5 @@ int vnt_beacon_enable(struct vnt_private *priv, struct ieee80211_vif *vif,
CARDbSetBeaconPeriod(priv, conf->beacon_int);
- ret = vnt_beacon_make(priv, vif);
-
- return ret;
+ return vnt_beacon_make(priv, vif);
}
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 04/24] staging: rtl8188eu: os_dep: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (2 preceding siblings ...)
2015-02-27 12:51 ` [PATCH 03/24] staging: vt6655: " Aya Mahfouz
@ 2015-02-27 12:53 ` Aya Mahfouz
2015-02-27 15:59 ` [Outreachy kernel] " Julia Lawall
2015-02-27 12:54 ` [PATCH 05/24] " Aya Mahfouz
` (19 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:53 UTC (permalink / raw)
To: outreachy-kernel
This patch removes variables that were simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 80e7ef9..38e8ba1 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -552,7 +552,6 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val)
u16 index;
u16 len;
u8 data;
- int ret;
request = 0x05;
requesttype = 0x00;/* write_out */
@@ -560,8 +559,7 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val)
wvalue = (u16)(addr&0x0000ffff);
len = 1;
data = val;
- ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
- return ret;
+ return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
}
int usb_write16(struct adapter *adapter, u32 addr, u16 val)
@@ -572,7 +570,6 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val)
u16 index;
u16 len;
__le32 data;
- int ret;
request = 0x05;
@@ -584,10 +581,7 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val)
data = cpu_to_le32(val & 0x0000ffff);
- ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
-
-
- return ret;
+ return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
}
int usb_write32(struct adapter *adapter, u32 addr, u32 val)
@@ -598,7 +592,6 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val)
u16 index;
u16 len;
__le32 data;
- int ret;
request = 0x05;
@@ -609,10 +602,7 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val)
len = 4;
data = cpu_to_le32(val);
- ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
-
-
- return ret;
+ return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
}
static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 05/24] staging: rtl8188eu: os_dep: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (3 preceding siblings ...)
2015-02-27 12:53 ` [PATCH 04/24] staging: rtl8188eu: os_dep: " Aya Mahfouz
@ 2015-02-27 12:54 ` Aya Mahfouz
2015-02-27 12:55 ` [PATCH 06/24] staging: lustre: ptlrpc: " Aya Mahfouz
` (18 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:54 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 24a8f5a..58998f2 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -1796,11 +1796,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- int ret;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
- ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
- return ret;
+ return rtw_set_wpa_ie(padapter, extra, wrqu->data.length);
}
static int rtw_wx_set_auth(struct net_device *dev,
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 06/24] staging: lustre: ptlrpc: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (4 preceding siblings ...)
2015-02-27 12:54 ` [PATCH 05/24] " Aya Mahfouz
@ 2015-02-27 12:55 ` Aya Mahfouz
2015-02-27 12:55 ` [PATCH 07/24] staging: lustre: osc: " Aya Mahfouz
` (17 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:55 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/ptlrpc/nrs.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
index d5fd721..371af9c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
@@ -912,7 +912,6 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs)
static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs,
struct ptlrpc_service_part *svcpt)
{
- int rc;
enum ptlrpc_nrs_queue_type queue;
LASSERT(mutex_is_locked(&nrs_core.nrs_mutex));
@@ -930,9 +929,7 @@ static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs,
INIT_LIST_HEAD(&nrs->nrs_policy_list);
INIT_LIST_HEAD(&nrs->nrs_policy_queued);
- rc = nrs_register_policies_locked(nrs);
-
- return rc;
+ return nrs_register_policies_locked(nrs);
}
/**
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 07/24] staging: lustre: osc: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (5 preceding siblings ...)
2015-02-27 12:55 ` [PATCH 06/24] staging: lustre: ptlrpc: " Aya Mahfouz
@ 2015-02-27 12:55 ` Aya Mahfouz
2015-02-27 12:56 ` [PATCH 08/24] staging: lustre: obdecho: " Aya Mahfouz
` (16 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:55 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/osc/lproc_osc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 1795d3a..3ef2b55 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -164,16 +164,13 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
struct obd_device *dev = m->private;
struct client_obd *cli = &dev->u.cli;
int shift = 20 - PAGE_CACHE_SHIFT;
- int rc;
- rc = seq_printf(m,
+ return seq_printf(m,
"used_mb: %d\n"
"busy_cnt: %d\n",
(atomic_read(&cli->cl_lru_in_list) +
atomic_read(&cli->cl_lru_busy)) >> shift,
atomic_read(&cli->cl_lru_busy));
-
- return rc;
}
/* shrink the number of caching pages to a specific number */
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 08/24] staging: lustre: obdecho: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (6 preceding siblings ...)
2015-02-27 12:55 ` [PATCH 07/24] staging: lustre: osc: " Aya Mahfouz
@ 2015-02-27 12:56 ` Aya Mahfouz
2015-02-27 12:57 ` [PATCH 09/24] staging: lustre: obdclass: " Aya Mahfouz
` (15 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:56 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/obdecho/echo_client.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 5f6d944..7f578b4 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -2158,7 +2158,6 @@ void echo_client_exit(void)
static int __init obdecho_init(void)
{
struct lprocfs_static_vars lvars;
- int rc;
LCONSOLE_INFO("Echo OBD driver; http://www.lustre.org/\n");
@@ -2167,9 +2166,7 @@ static int __init obdecho_init(void)
lprocfs_echo_init_vars(&lvars);
- rc = echo_client_init();
-
- return rc;
+ return echo_client_init();
}
static void /*__exit*/ obdecho_exit(void)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 09/24] staging: lustre: obdclass: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (7 preceding siblings ...)
2015-02-27 12:56 ` [PATCH 08/24] staging: lustre: obdecho: " Aya Mahfouz
@ 2015-02-27 12:57 ` Aya Mahfouz
2015-02-27 12:57 ` [PATCH 10/24] " Aya Mahfouz
` (14 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:57 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index 83bf168..e104662 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -1769,8 +1769,6 @@ EXPORT_SYMBOL(lu_env_refill);
int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags,
__u32 stags)
{
- int result;
-
if ((env->le_ctx.lc_tags & ctags) != ctags) {
env->le_ctx.lc_version = 0;
env->le_ctx.lc_tags |= ctags;
@@ -1781,9 +1779,7 @@ int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags,
env->le_ses->lc_tags |= stags;
}
- result = lu_env_refill(env);
-
- return result;
+ return lu_env_refill(env);
}
EXPORT_SYMBOL(lu_env_refill_by_tags);
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 10/24] staging: lustre: obdclass: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (8 preceding siblings ...)
2015-02-27 12:57 ` [PATCH 09/24] staging: lustre: obdclass: " Aya Mahfouz
@ 2015-02-27 12:57 ` Aya Mahfouz
2015-02-27 12:59 ` [PATCH 11/24] staging: lustre: mgc: " Aya Mahfouz
` (13 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:57 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/obdclass/dt_object.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/dt_object.c b/drivers/staging/lustre/lustre/obdclass/dt_object.c
index e7be26e..b1eee0a 100644
--- a/drivers/staging/lustre/lustre/obdclass/dt_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/dt_object.c
@@ -424,11 +424,8 @@ EXPORT_SYMBOL(dt_find_or_create);
/* dt class init function. */
int dt_global_init(void)
{
- int result;
-
LU_CONTEXT_KEY_INIT(&dt_key);
- result = lu_context_key_register(&dt_key);
- return result;
+ return lu_context_key_register(&dt_key);
}
void dt_global_fini(void)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 11/24] staging: lustre: mgc: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (9 preceding siblings ...)
2015-02-27 12:57 ` [PATCH 10/24] " Aya Mahfouz
@ 2015-02-27 12:59 ` Aya Mahfouz
2015-02-27 13:01 ` [PATCH 12/24] staging: lustre: mdc: " Aya Mahfouz
` (12 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 12:59 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 60d2b0f..2e24bba 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -690,8 +690,6 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
static int mgc_cleanup(struct obd_device *obd)
{
- int rc;
-
/* COMPAT_146 - old config logs may have added profiles we don't
know about */
if (obd->obd_type->typ_refcnt <= 1)
@@ -701,8 +699,7 @@ static int mgc_cleanup(struct obd_device *obd)
lprocfs_obd_cleanup(obd);
ptlrpcd_decref();
- rc = client_obd_cleanup(obd);
- return rc;
+ return client_obd_cleanup(obd);
}
static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 12/24] staging: lustre: mdc: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (10 preceding siblings ...)
2015-02-27 12:59 ` [PATCH 11/24] staging: lustre: mgc: " Aya Mahfouz
@ 2015-02-27 13:01 ` Aya Mahfouz
2015-02-27 13:02 ` [PATCH 13/24] " Aya Mahfouz
` (11 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:01 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/mdc/mdc_request.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index ef27447..c04eec5 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -2707,14 +2707,12 @@ static struct md_ops mdc_md_ops = {
static int __init mdc_init(void)
{
- int rc;
struct lprocfs_static_vars lvars = { NULL };
lprocfs_mdc_init_vars(&lvars);
- rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
+ return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
LUSTRE_MDC_NAME, NULL);
- return rc;
}
static void /*__exit*/ mdc_exit(void)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 13/24] staging: lustre: mdc: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (11 preceding siblings ...)
2015-02-27 13:01 ` [PATCH 12/24] staging: lustre: mdc: " Aya Mahfouz
@ 2015-02-27 13:02 ` Aya Mahfouz
2015-02-27 15:56 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:02 ` [PATCH 14/24] staging: lustre: lov: " Aya Mahfouz
` (10 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:02 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index d1c224e..b72319b 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -176,12 +176,10 @@ int mdc_cancel_unused(struct obd_export *exp,
{
struct ldlm_res_id res_id;
struct obd_device *obd = class_exp2obd(exp);
- int rc;
fid_build_reg_res_name(fid, &res_id);
- rc = ldlm_cli_cancel_unused_resource(obd->obd_namespace, &res_id,
+ return ldlm_cli_cancel_unused_resource(obd->obd_namespace, &res_id,
policy, mode, flags, opaque);
- return rc;
}
int mdc_null_inode(struct obd_export *exp,
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 14/24] staging: lustre: lov: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (12 preceding siblings ...)
2015-02-27 13:02 ` [PATCH 13/24] " Aya Mahfouz
@ 2015-02-27 13:02 ` Aya Mahfouz
2015-02-27 15:56 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:03 ` [PATCH 15/24] staging: lustre: lmv: remove unused variables Aya Mahfouz
` (9 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:02 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 2c6c558..9960b45 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -314,7 +314,7 @@ static int lov_disconnect(struct obd_export *exp)
{
struct obd_device *obd = class_exp2obd(exp);
struct lov_obd *lov = &obd->u.lov;
- int i, rc;
+ int i;
if (!lov->lov_tgts)
goto out;
@@ -340,8 +340,7 @@ static int lov_disconnect(struct obd_export *exp)
obd_putref(obd);
out:
- rc = class_disconnect(exp); /* bz 9811 */
- return rc;
+ return class_disconnect(exp);
}
/* Error codes:
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 15/24] staging: lustre: lmv: remove unused variables
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (13 preceding siblings ...)
2015-02-27 13:02 ` [PATCH 14/24] staging: lustre: lov: " Aya Mahfouz
@ 2015-02-27 13:03 ` Aya Mahfouz
2015-03-02 0:27 ` [Outreachy kernel] " Greg KH
2015-02-27 13:06 ` [PATCH 16/24] staging: lustre: llite: remove unused variable Aya Mahfouz
` (8 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:03 UTC (permalink / raw)
To: outreachy-kernel
This patch removes variables that were simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 6e446ac..d0dcbf9 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -2555,10 +2555,8 @@ static int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
__u64 *bits)
{
struct lmv_obd *lmv = &exp->exp_obd->u.lmv;
- int rc;
- rc = md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits);
- return rc;
+ return md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits);
}
static ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
@@ -2870,13 +2868,11 @@ static struct md_ops lmv_md_ops = {
static int __init lmv_init(void)
{
struct lprocfs_static_vars lvars;
- int rc;
lprocfs_lmv_init_vars(&lvars);
- rc = class_register_type(&lmv_obd_ops, &lmv_md_ops,
+ return class_register_type(&lmv_obd_ops, &lmv_md_ops,
lvars.module_vars, LUSTRE_LMV_NAME, NULL);
- return rc;
}
static void lmv_exit(void)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 16/24] staging: lustre: llite: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (14 preceding siblings ...)
2015-02-27 13:03 ` [PATCH 15/24] staging: lustre: lmv: remove unused variables Aya Mahfouz
@ 2015-02-27 13:06 ` Aya Mahfouz
2015-02-27 15:55 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:06 ` [PATCH 17/24] " Aya Mahfouz
` (7 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:06 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 91bba79..6acf422 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -309,12 +309,9 @@ static int vvp_io_read_lock(const struct lu_env *env,
{
struct cl_io *io = ios->cis_io;
struct cl_io_rw_common *rd = &io->u.ci_rd.rd;
- int result;
- result = vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos,
+ return vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos,
rd->crw_pos + rd->crw_count - 1);
-
- return result;
}
static int vvp_io_fault_lock(const struct lu_env *env,
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 17/24] staging: lustre: llite: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (15 preceding siblings ...)
2015-02-27 13:06 ` [PATCH 16/24] staging: lustre: llite: remove unused variable Aya Mahfouz
@ 2015-02-27 13:06 ` Aya Mahfouz
2015-02-27 13:07 ` [PATCH 18/24] " Aya Mahfouz
` (6 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:06 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/llite/lproc_llite.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index aaa13bd..35e0b39 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -789,11 +789,8 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- int rc;
-
- rc = seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
- return rc;
+ return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
}
static ssize_t ll_xattr_cache_seq_write(struct file *file,
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 18/24] staging: lustre: llite: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (16 preceding siblings ...)
2015-02-27 13:06 ` [PATCH 17/24] " Aya Mahfouz
@ 2015-02-27 13:07 ` Aya Mahfouz
2015-02-27 15:54 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:07 ` [PATCH 19/24] " Aya Mahfouz
` (5 subsequent siblings)
23 siblings, 1 reply; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:07 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/llite/file.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 0fd113d..3ae4d85 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -888,7 +888,6 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
{
struct ldlm_lock *lock;
bool cancelled = true;
- int rc;
lock = ldlm_handle2lock(&och->och_lease_handle);
if (lock != NULL) {
@@ -906,9 +905,8 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
if (lease_broken != NULL)
*lease_broken = cancelled;
- rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
+ return ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
NULL);
- return rc;
}
/* Fills the obdo with the attributes for the lsm */
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 19/24] staging: lustre: llite: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (17 preceding siblings ...)
2015-02-27 13:07 ` [PATCH 18/24] " Aya Mahfouz
@ 2015-02-27 13:07 ` Aya Mahfouz
2015-02-27 13:08 ` [PATCH 20/24] staging: iio: meter: " Aya Mahfouz
` (4 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:07 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/lustre/lustre/llite/dcache.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
index ddf1fa9..3078dd9 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -339,13 +339,10 @@ static int ll_revalidate_dentry(struct dentry *dentry,
*/
static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
{
- int rc;
-
CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n",
dentry, flags);
- rc = ll_revalidate_dentry(dentry, flags);
- return rc;
+ return ll_revalidate_dentry(dentry, flags);
}
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 20/24] staging: iio: meter: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (18 preceding siblings ...)
2015-02-27 13:07 ` [PATCH 19/24] " Aya Mahfouz
@ 2015-02-27 13:08 ` Aya Mahfouz
2015-02-27 13:09 ` [PATCH 21/24] staging: iio: meter: remove unused variables Aya Mahfouz
` (3 subsequent siblings)
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:08 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/iio/meter/ade7759.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index b0c7dbc..694e0ce 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -215,18 +215,15 @@ error_ret:
static int ade7759_reset(struct device *dev)
{
- int ret;
u16 val;
ade7759_spi_read_reg_16(dev,
ADE7759_MODE,
&val);
val |= 1 << 6; /* Software Chip Reset */
- ret = ade7759_spi_write_reg_16(dev,
+ return ade7759_spi_write_reg_16(dev,
ADE7759_MODE,
val);
-
- return ret;
}
static IIO_DEV_ATTR_AENERGY(ade7759_read_40bit, ADE7759_AENERGY);
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 21/24] staging: iio: meter: remove unused variables
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (19 preceding siblings ...)
2015-02-27 13:08 ` [PATCH 20/24] staging: iio: meter: " Aya Mahfouz
@ 2015-02-27 13:09 ` Aya Mahfouz
2015-02-27 15:53 ` [Outreachy kernel] " Julia Lawall
2015-02-27 16:00 ` Daniel Baluta
2015-02-27 13:09 ` [PATCH 22/24] staging: iio: light: remove unused variable Aya Mahfouz
` (2 subsequent siblings)
23 siblings, 2 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:09 UTC (permalink / raw)
To: outreachy-kernel
This patch removes variables that were simply used to store the
return value of a function call before returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/iio/meter/ade7758_core.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 70e96b2..3d2fae4 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -300,18 +300,15 @@ error_ret:
static int ade7758_reset(struct device *dev)
{
- int ret;
u8 val;
ade7758_spi_read_reg_8(dev,
ADE7758_OPMODE,
&val);
val |= 1 << 6; /* Software Chip Reset */
- ret = ade7758_spi_write_reg_8(dev,
+ return ade7758_spi_write_reg_8(dev,
ADE7758_OPMODE,
val);
-
- return ret;
}
static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
@@ -441,18 +438,15 @@ error_ret:
/* Power down the device */
static int ade7758_stop_device(struct device *dev)
{
- int ret;
u8 val;
ade7758_spi_read_reg_8(dev,
ADE7758_OPMODE,
&val);
val |= 7 << 3; /* ADE7758 powered down */
- ret = ade7758_spi_write_reg_8(dev,
+ return ade7758_spi_write_reg_8(dev,
ADE7758_OPMODE,
val);
-
- return ret;
}
static int ade7758_initial_setup(struct iio_dev *indio_dev)
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 22/24] staging: iio: light: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (20 preceding siblings ...)
2015-02-27 13:09 ` [PATCH 21/24] staging: iio: meter: remove unused variables Aya Mahfouz
@ 2015-02-27 13:09 ` Aya Mahfouz
2015-02-27 13:10 ` [PATCH 23/24] staging: fbtft: " Aya Mahfouz
2015-02-27 13:11 ` [PATCH 24/24] staging: dgap: " Aya Mahfouz
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:09 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/iio/light/tsl2583.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
index 8afae8e..b5e1b8b 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -471,14 +471,12 @@ static int taos_chip_on(struct iio_dev *indio_dev)
static int taos_chip_off(struct iio_dev *indio_dev)
{
struct tsl2583_chip *chip = iio_priv(indio_dev);
- int ret;
/* turn device off */
chip->taos_chip_status = TSL258X_CHIP_SUSPENDED;
- ret = i2c_smbus_write_byte_data(chip->client,
+ return i2c_smbus_write_byte_data(chip->client,
TSL258X_CMD_REG | TSL258X_CNTRL,
0x00);
- return ret;
}
/* Sysfs Interface Functions */
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 23/24] staging: fbtft: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (21 preceding siblings ...)
2015-02-27 13:09 ` [PATCH 22/24] staging: iio: light: remove unused variable Aya Mahfouz
@ 2015-02-27 13:10 ` Aya Mahfouz
2015-02-27 13:11 ` [PATCH 24/24] staging: dgap: " Aya Mahfouz
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:10 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/fbtft/fbtft-core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index ac4287f..8ca4511 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1046,7 +1046,6 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info)
{
struct fbtft_par *par = fb_info->par;
struct spi_device *spi = par->spi;
- int ret;
if (spi)
spi_set_drvdata(spi, NULL);
@@ -1055,8 +1054,7 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info)
if (par->fbtftops.unregister_backlight)
par->fbtftops.unregister_backlight(par);
fbtft_sysfs_exit(par);
- ret = unregister_framebuffer(fb_info);
- return ret;
+ return unregister_framebuffer(fb_info);
}
EXPORT_SYMBOL(fbtft_unregister_framebuffer);
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 24/24] staging: dgap: remove unused variable
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
` (22 preceding siblings ...)
2015-02-27 13:10 ` [PATCH 23/24] staging: fbtft: " Aya Mahfouz
@ 2015-02-27 13:11 ` Aya Mahfouz
23 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 13:11 UTC (permalink / raw)
To: outreachy-kernel
This patch removes a variable that was simply used to
store the return value of a function call before
returning it.
The issue was detected and resolved using the following
coccinelle script:
@@
identifier len,f;
@@
-int len;
... when != len
when strict
-len =
+return
f(...);
-return len;
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
drivers/staging/dgap/dgap.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 7184747..914e332 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -3979,7 +3979,6 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)
int result;
u8 mstat;
ulong lock_flags;
- int rc;
spin_lock_irqsave(&ch->ch_lock, lock_flags);
@@ -4004,9 +4003,7 @@ static int dgap_get_modem_info(struct channel_t *ch, unsigned int __user *value)
if (mstat & D_CD(ch))
result |= TIOCM_CD;
- rc = put_user(result, value);
-
- return rc;
+ return put_user(result, value);
}
/*
--
1.9.3
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
2015-02-27 13:09 ` [PATCH 21/24] staging: iio: meter: remove unused variables Aya Mahfouz
@ 2015-02-27 15:53 ` Julia Lawall
2015-02-27 16:00 ` Daniel Baluta
1 sibling, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:53 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes variables that were simply used to store the
> return value of a function call before returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/iio/meter/ade7758_core.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
> index 70e96b2..3d2fae4 100644
> --- a/drivers/staging/iio/meter/ade7758_core.c
> +++ b/drivers/staging/iio/meter/ade7758_core.c
> @@ -300,18 +300,15 @@ error_ret:
>
> static int ade7758_reset(struct device *dev)
> {
> - int ret;
> u8 val;
>
> ade7758_spi_read_reg_8(dev,
> ADE7758_OPMODE,
> &val);
> val |= 1 << 6; /* Software Chip Reset */
> - ret = ade7758_spi_write_reg_8(dev,
> + return ade7758_spi_write_reg_8(dev,
> ADE7758_OPMODE,
> val);
It's a different problem, but this call could really fit on one line.
julia
> -
> - return ret;
> }
>
> static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
> @@ -441,18 +438,15 @@ error_ret:
> /* Power down the device */
> static int ade7758_stop_device(struct device *dev)
> {
> - int ret;
> u8 val;
>
> ade7758_spi_read_reg_8(dev,
> ADE7758_OPMODE,
> &val);
> val |= 7 << 3; /* ADE7758 powered down */
> - ret = ade7758_spi_write_reg_8(dev,
> + return ade7758_spi_write_reg_8(dev,
> ADE7758_OPMODE,
> val);
> -
> - return ret;
> }
>
> static int ade7758_initial_setup(struct iio_dev *indio_dev)
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a3c512e1b92259c27416e0d8d0fd4a4db59fc0a9.1425035012.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 18/24] staging: lustre: llite: remove unused variable
2015-02-27 13:07 ` [PATCH 18/24] " Aya Mahfouz
@ 2015-02-27 15:54 ` Julia Lawall
2015-02-27 19:09 ` Aya Mahfouz
0 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:54 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes a variable that was simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/lustre/lustre/llite/file.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
> index 0fd113d..3ae4d85 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -888,7 +888,6 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
> {
> struct ldlm_lock *lock;
> bool cancelled = true;
> - int rc;
>
> lock = ldlm_handle2lock(&och->och_lease_handle);
> if (lock != NULL) {
> @@ -906,9 +905,8 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
> if (lease_broken != NULL)
> *lease_broken = cancelled;
>
> - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
> + return ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
> NULL);
The NULL argument was aligned with the first argument before, but now it
is not.
julia
> - return rc;
> }
>
> /* Fills the obdo with the attributes for the lsm */
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/0ae8fe1e6a7e12be20f2d16ad8d0a966564d8654.1425035012.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 16/24] staging: lustre: llite: remove unused variable
2015-02-27 13:06 ` [PATCH 16/24] staging: lustre: llite: remove unused variable Aya Mahfouz
@ 2015-02-27 15:55 ` Julia Lawall
0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:55 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes a variable that was simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
> index 91bba79..6acf422 100644
> --- a/drivers/staging/lustre/lustre/llite/vvp_io.c
> +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
> @@ -309,12 +309,9 @@ static int vvp_io_read_lock(const struct lu_env *env,
> {
> struct cl_io *io = ios->cis_io;
> struct cl_io_rw_common *rd = &io->u.ci_rd.rd;
> - int result;
>
> - result = vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos,
> + return vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos,
> rd->crw_pos + rd->crw_count - 1);
Same argument alignment problem here.
julia
> -
> - return result;
> }
>
> static int vvp_io_fault_lock(const struct lu_env *env,
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/8046f90779d408bf363802fd0c5298dbc759d3dc.1425035011.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 14/24] staging: lustre: lov: remove unused variable
2015-02-27 13:02 ` [PATCH 14/24] staging: lustre: lov: " Aya Mahfouz
@ 2015-02-27 15:56 ` Julia Lawall
2015-02-27 19:13 ` Aya Mahfouz
0 siblings, 1 reply; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:56 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes a variable that was simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
> index 2c6c558..9960b45 100644
> --- a/drivers/staging/lustre/lustre/lov/lov_obd.c
> +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
> @@ -314,7 +314,7 @@ static int lov_disconnect(struct obd_export *exp)
> {
> struct obd_device *obd = class_exp2obd(exp);
> struct lov_obd *lov = &obd->u.lov;
> - int i, rc;
> + int i;
>
> if (!lov->lov_tgts)
> goto out;
> @@ -340,8 +340,7 @@ static int lov_disconnect(struct obd_export *exp)
> obd_putref(obd);
>
> out:
> - rc = class_disconnect(exp); /* bz 9811 */
> - return rc;
> + return class_disconnect(exp);
The comment should probably be preserved.
julia
> }
>
> /* Error codes:
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/8f04ef8c0696cbc93f0ec76b4860354d50fd0b88.1425035010.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 13/24] staging: lustre: mdc: remove unused variable
2015-02-27 13:02 ` [PATCH 13/24] " Aya Mahfouz
@ 2015-02-27 15:56 ` Julia Lawall
0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:56 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes a variable that was simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
> index d1c224e..b72319b 100644
> --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
> +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
> @@ -176,12 +176,10 @@ int mdc_cancel_unused(struct obd_export *exp,
> {
> struct ldlm_res_id res_id;
> struct obd_device *obd = class_exp2obd(exp);
> - int rc;
>
> fid_build_reg_res_name(fid, &res_id);
> - rc = ldlm_cli_cancel_unused_resource(obd->obd_namespace, &res_id,
> + return ldlm_cli_cancel_unused_resource(obd->obd_namespace, &res_id,
> policy, mode, flags, opaque);
Argument alignment.
julia
> - return rc;
> }
>
> int mdc_null_inode(struct obd_export *exp,
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/6d810f755db18473df909a705c5258025103e33f.1425035010.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 04/24] staging: rtl8188eu: os_dep: remove unused variable
2015-02-27 12:53 ` [PATCH 04/24] staging: rtl8188eu: os_dep: " Aya Mahfouz
@ 2015-02-27 15:59 ` Julia Lawall
0 siblings, 0 replies; 36+ messages in thread
From: Julia Lawall @ 2015-02-27 15:59 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, 27 Feb 2015, Aya Mahfouz wrote:
> This patch removes variables that were simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
> index 80e7ef9..38e8ba1 100644
> --- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
> +++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
> @@ -552,7 +552,6 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val)
> u16 index;
> u16 len;
> u8 data;
> - int ret;
>
> request = 0x05;
> requesttype = 0x00;/* write_out */
> @@ -560,8 +559,7 @@ int usb_write8(struct adapter *adapter, u32 addr, u8 val)
> wvalue = (u16)(addr&0x0000ffff);
> len = 1;
> data = val;
> - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
> - return ret;
> + return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
You make the 80 character problem worse, so you could fix it at the same
time.
julia
> }
>
> int usb_write16(struct adapter *adapter, u32 addr, u16 val)
> @@ -572,7 +570,6 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val)
> u16 index;
> u16 len;
> __le32 data;
> - int ret;
>
>
> request = 0x05;
> @@ -584,10 +581,7 @@ int usb_write16(struct adapter *adapter, u32 addr, u16 val)
>
> data = cpu_to_le32(val & 0x0000ffff);
>
> - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
> -
> -
> - return ret;
> + return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
> }
>
> int usb_write32(struct adapter *adapter, u32 addr, u32 val)
> @@ -598,7 +592,6 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val)
> u16 index;
> u16 len;
> __le32 data;
> - int ret;
>
>
> request = 0x05;
> @@ -609,10 +602,7 @@ int usb_write32(struct adapter *adapter, u32 addr, u32 val)
> len = 4;
> data = cpu_to_le32(val);
>
> - ret = usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
> -
> -
> - return ret;
> + return usbctrl_vendorreq(adapter, request, wvalue, index, &data, len, requesttype);
> }
>
> static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
> --
> 1.9.3
>
>
> --
> Kind Regards,
> Aya Saif El-yazal Mahfouz
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/b9c765d115a8845bd37120165627f37c29af1b9c.1425035005.git.mahfouz.saif.elyazal%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
2015-02-27 13:09 ` [PATCH 21/24] staging: iio: meter: remove unused variables Aya Mahfouz
2015-02-27 15:53 ` [Outreachy kernel] " Julia Lawall
@ 2015-02-27 16:00 ` Daniel Baluta
2015-02-27 19:06 ` Aya Mahfouz
1 sibling, 1 reply; 36+ messages in thread
From: Daniel Baluta @ 2015-02-27 16:00 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, Feb 27, 2015 at 3:09 PM, Aya Mahfouz
<mahfouz.saif.elyazal@gmail.com> wrote:
> This patch removes variables that were simply used to store the
> return value of a function call before returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/iio/meter/ade7758_core.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
> index 70e96b2..3d2fae4 100644
> --- a/drivers/staging/iio/meter/ade7758_core.c
> +++ b/drivers/staging/iio/meter/ade7758_core.c
> @@ -300,18 +300,15 @@ error_ret:
>
> static int ade7758_reset(struct device *dev)
> {
> - int ret;
> u8 val;
>
> ade7758_spi_read_reg_8(dev,
> ADE7758_OPMODE,
> &val);
> val |= 1 << 6; /* Software Chip Reset */
> - ret = ade7758_spi_write_reg_8(dev,
> + return ade7758_spi_write_reg_8(dev,
> ADE7758_OPMODE,
> val);
> -
> - return ret;
> }
>
> static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
> @@ -441,18 +438,15 @@ error_ret:
> /* Power down the device */
> static int ade7758_stop_device(struct device *dev)
> {
> - int ret;
> u8 val;
>
> ade7758_spi_read_reg_8(dev,
> ADE7758_OPMODE,
> &val);
> val |= 7 << 3; /* ADE7758 powered down */
> - ret = ade7758_spi_write_reg_8(dev,
> + return ade7758_spi_write_reg_8(dev,
> ADE7758_OPMODE,
> val);
> -
> - return ret;
> }
>
I would advise against this change. It would be better to check
for ret value and add an error message.
Daniel.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
2015-02-27 16:00 ` Daniel Baluta
@ 2015-02-27 19:06 ` Aya Mahfouz
0 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 19:06 UTC (permalink / raw)
To: Daniel Baluta; +Cc: outreachy-kernel
On Fri, Feb 27, 2015 at 06:00:53PM +0200, Daniel Baluta wrote:
> On Fri, Feb 27, 2015 at 3:09 PM, Aya Mahfouz
> <mahfouz.saif.elyazal@gmail.com> wrote:
> > This patch removes variables that were simply used to store the
> > return value of a function call before returning it.
> >
> > The issue was detected and resolved using the following
> > coccinelle script:
> >
> > @@
> > identifier len,f;
> > @@
> >
> > -int len;
> > ... when != len
> > when strict
> > -len =
> > +return
> > f(...);
> > -return len;
> >
> > Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> > ---
> > drivers/staging/iio/meter/ade7758_core.c | 10 ++--------
> > 1 file changed, 2 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
> > index 70e96b2..3d2fae4 100644
> > --- a/drivers/staging/iio/meter/ade7758_core.c
> > +++ b/drivers/staging/iio/meter/ade7758_core.c
> > @@ -300,18 +300,15 @@ error_ret:
> >
> > static int ade7758_reset(struct device *dev)
> > {
> > - int ret;
> > u8 val;
> >
> > ade7758_spi_read_reg_8(dev,
> > ADE7758_OPMODE,
> > &val);
> > val |= 1 << 6; /* Software Chip Reset */
> > - ret = ade7758_spi_write_reg_8(dev,
> > + return ade7758_spi_write_reg_8(dev,
> > ADE7758_OPMODE,
> > val);
> > -
> > - return ret;
> > }
> >
> > static IIO_DEV_ATTR_VPEAK(S_IWUSR | S_IRUGO,
> > @@ -441,18 +438,15 @@ error_ret:
> > /* Power down the device */
> > static int ade7758_stop_device(struct device *dev)
> > {
> > - int ret;
> > u8 val;
> >
> > ade7758_spi_read_reg_8(dev,
> > ADE7758_OPMODE,
> > &val);
> > val |= 7 << 3; /* ADE7758 powered down */
> > - ret = ade7758_spi_write_reg_8(dev,
> > + return ade7758_spi_write_reg_8(dev,
> > ADE7758_OPMODE,
> > val);
> > -
> > - return ret;
> > }
> >
>
> I would advise against this change. It would be better to check
> for ret value and add an error message.
>
Sure thing. I will read the documentation of this code and send
a second patch by tomorrow.
Thanks for your feedback Daniel.
> Daniel.
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 18/24] staging: lustre: llite: remove unused variable
2015-02-27 15:54 ` [Outreachy kernel] " Julia Lawall
@ 2015-02-27 19:09 ` Aya Mahfouz
0 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 19:09 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel
On Fri, Feb 27, 2015 at 04:54:36PM +0100, Julia Lawall wrote:
>
>
> On Fri, 27 Feb 2015, Aya Mahfouz wrote:
>
> > This patch removes a variable that was simply used to
> > store the return value of a function call before
> > returning it.
> >
> > The issue was detected and resolved using the following
> > coccinelle script:
> >
> > @@
> > identifier len,f;
> > @@
> >
> > -int len;
> > ... when != len
> > when strict
> > -len =
> > +return
> > f(...);
> > -return len;
> >
> > Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> > ---
> > drivers/staging/lustre/lustre/llite/file.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
> > index 0fd113d..3ae4d85 100644
> > --- a/drivers/staging/lustre/lustre/llite/file.c
> > +++ b/drivers/staging/lustre/lustre/llite/file.c
> > @@ -888,7 +888,6 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
> > {
> > struct ldlm_lock *lock;
> > bool cancelled = true;
> > - int rc;
> >
> > lock = ldlm_handle2lock(&och->och_lease_handle);
> > if (lock != NULL) {
> > @@ -906,9 +905,8 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
> > if (lease_broken != NULL)
> > *lease_broken = cancelled;
> >
> > - rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
> > + return ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och,
> > NULL);
>
> The NULL argument was aligned with the first argument before, but now it
> is not.
>
Will fix it. Thank you Julia.
> julia
>
> > - return rc;
> > }
> >
> > /* Fills the obdo with the attributes for the lsm */
> > --
> > 1.9.3
> >
> >
> > --
> > Kind Regards,
> > Aya Saif El-yazal Mahfouz
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/0ae8fe1e6a7e12be20f2d16ad8d0a966564d8654.1425035012.git.mahfouz.saif.elyazal%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 14/24] staging: lustre: lov: remove unused variable
2015-02-27 15:56 ` [Outreachy kernel] " Julia Lawall
@ 2015-02-27 19:13 ` Aya Mahfouz
0 siblings, 0 replies; 36+ messages in thread
From: Aya Mahfouz @ 2015-02-27 19:13 UTC (permalink / raw)
To: Julia Lawall; +Cc: outreachy-kernel
On Fri, Feb 27, 2015 at 04:56:19PM +0100, Julia Lawall wrote:
>
>
> On Fri, 27 Feb 2015, Aya Mahfouz wrote:
>
> > This patch removes a variable that was simply used to
> > store the return value of a function call before
> > returning it.
> >
> > The issue was detected and resolved using the following
> > coccinelle script:
> >
> > @@
> > identifier len,f;
> > @@
> >
> > -int len;
> > ... when != len
> > when strict
> > -len =
> > +return
> > f(...);
> > -return len; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> > ---
> > drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
> > index 2c6c558..9960b45 100644
> > --- a/drivers/staging/lustre/lustre/lov/lov_obd.c
> > +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
> > @@ -314,7 +314,7 @@ static int lov_disconnect(struct obd_export *exp)
> > {
> > struct obd_device *obd = class_exp2obd(exp);
> > struct lov_obd *lov = &obd->u.lov;
> > - int i, rc;
> > + int i;
> >
> > if (!lov->lov_tgts)
> > goto out;
> > @@ -340,8 +340,7 @@ static int lov_disconnect(struct obd_export *exp)
> > obd_putref(obd);
> >
> > out:
> > - rc = class_disconnect(exp); /* bz 9811 */
> > - return rc;
> > + return class_disconnect(exp);
>
> The comment should probably be preserved.
>
> julia
>
Yes, you're totally right. I've managed it in another patch. Seems that
I wasn't diligent enough.
> > }
> >
> > /* Error codes:
> > --
> > 1.9.3
> >
> >
> > --
> > Kind Regards,
> > Aya Saif El-yazal Mahfouz
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/8f04ef8c0696cbc93f0ec76b4860354d50fd0b88.1425035010.git.mahfouz.saif.elyazal%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
--
Kind Regards,
Aya Saif El-yazal Mahfouz
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [Outreachy kernel] [PATCH 15/24] staging: lustre: lmv: remove unused variables
2015-02-27 13:03 ` [PATCH 15/24] staging: lustre: lmv: remove unused variables Aya Mahfouz
@ 2015-03-02 0:27 ` Greg KH
0 siblings, 0 replies; 36+ messages in thread
From: Greg KH @ 2015-03-02 0:27 UTC (permalink / raw)
To: Aya Mahfouz; +Cc: outreachy-kernel
On Fri, Feb 27, 2015 at 03:03:30PM +0200, Aya Mahfouz wrote:
> This patch removes variables that were simply used to
> store the return value of a function call before
> returning it.
>
> The issue was detected and resolved using the following
> coccinelle script:
>
> @@
> identifier len,f;
> @@
>
> -int len;
> ... when != len
> when strict
> -len =
> +return
> f(...);
> -return len;
>
> Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
> ---
> drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> index 6e446ac..d0dcbf9 100644
> --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
> @@ -2555,10 +2555,8 @@ static int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
> __u64 *bits)
> {
> struct lmv_obd *lmv = &exp->exp_obd->u.lmv;
> - int rc;
>
> - rc = md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits);
> - return rc;
> + return md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits);
Extra space here :(
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2015-03-02 0:27 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-27 12:48 [PATCH 00/24] remove unused variables Aya Mahfouz
2015-02-27 12:49 ` [PATCH 01/24] staging: wlan-ng: remove unused variable Aya Mahfouz
2015-02-27 12:50 ` [PATCH 02/24] " Aya Mahfouz
2015-02-27 12:51 ` [PATCH 03/24] staging: vt6655: " Aya Mahfouz
2015-02-27 12:53 ` [PATCH 04/24] staging: rtl8188eu: os_dep: " Aya Mahfouz
2015-02-27 15:59 ` [Outreachy kernel] " Julia Lawall
2015-02-27 12:54 ` [PATCH 05/24] " Aya Mahfouz
2015-02-27 12:55 ` [PATCH 06/24] staging: lustre: ptlrpc: " Aya Mahfouz
2015-02-27 12:55 ` [PATCH 07/24] staging: lustre: osc: " Aya Mahfouz
2015-02-27 12:56 ` [PATCH 08/24] staging: lustre: obdecho: " Aya Mahfouz
2015-02-27 12:57 ` [PATCH 09/24] staging: lustre: obdclass: " Aya Mahfouz
2015-02-27 12:57 ` [PATCH 10/24] " Aya Mahfouz
2015-02-27 12:59 ` [PATCH 11/24] staging: lustre: mgc: " Aya Mahfouz
2015-02-27 13:01 ` [PATCH 12/24] staging: lustre: mdc: " Aya Mahfouz
2015-02-27 13:02 ` [PATCH 13/24] " Aya Mahfouz
2015-02-27 15:56 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:02 ` [PATCH 14/24] staging: lustre: lov: " Aya Mahfouz
2015-02-27 15:56 ` [Outreachy kernel] " Julia Lawall
2015-02-27 19:13 ` Aya Mahfouz
2015-02-27 13:03 ` [PATCH 15/24] staging: lustre: lmv: remove unused variables Aya Mahfouz
2015-03-02 0:27 ` [Outreachy kernel] " Greg KH
2015-02-27 13:06 ` [PATCH 16/24] staging: lustre: llite: remove unused variable Aya Mahfouz
2015-02-27 15:55 ` [Outreachy kernel] " Julia Lawall
2015-02-27 13:06 ` [PATCH 17/24] " Aya Mahfouz
2015-02-27 13:07 ` [PATCH 18/24] " Aya Mahfouz
2015-02-27 15:54 ` [Outreachy kernel] " Julia Lawall
2015-02-27 19:09 ` Aya Mahfouz
2015-02-27 13:07 ` [PATCH 19/24] " Aya Mahfouz
2015-02-27 13:08 ` [PATCH 20/24] staging: iio: meter: " Aya Mahfouz
2015-02-27 13:09 ` [PATCH 21/24] staging: iio: meter: remove unused variables Aya Mahfouz
2015-02-27 15:53 ` [Outreachy kernel] " Julia Lawall
2015-02-27 16:00 ` Daniel Baluta
2015-02-27 19:06 ` Aya Mahfouz
2015-02-27 13:09 ` [PATCH 22/24] staging: iio: light: remove unused variable Aya Mahfouz
2015-02-27 13:10 ` [PATCH 23/24] staging: fbtft: " Aya Mahfouz
2015-02-27 13:11 ` [PATCH 24/24] staging: dgap: " Aya Mahfouz
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.