remove unused variables
Subsystems (5)
cover remove unused variables
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(-)
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 1/24 staging: wlan-ng: remove unused variable
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;
--- drivers/staging/wlan-ng/prism2sta.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/wlan-ng/prism2sta.c +1 -4
@@ -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); }/*----------------------------------------------------------------
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 2/24 staging: wlan-ng: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/wlan-ng/prism2mib.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/staging/wlan-ng/prism2mib.c +2 -9
@@ -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); }/*----------------------------------------------------------------
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 3/24 staging: vt6655: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/vt6655/rxtx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/vt6655/rxtx.c +1 -5
@@ -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); }
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 4/24 staging: rtl8188eu: os_dep: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +3 -13
@@ -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)
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 04/24] staging: rtl8188eu: os_dep: remove unused variable
Quoted 37 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +0
-1@@ -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 */
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c int usb_write8(struct adapter *adapter, u32 addr, u8 val) · line 562
Quoted 6 lines
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +1
-2@@ -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
Quoted 58 lines
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c +2
-11}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 [email protected].
To post to this group, send email to [email protected].
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.
PATCH 5/24 staging: rtl8188eu: os_dep: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +1 -3
@@ -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,
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 6/24 staging: lustre: ptlrpc: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/nrs.c +1 -4
@@ -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); }/**
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 7/24 staging: lustre: osc: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -4
@@ -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 */
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 8/24 staging: lustre: obdecho: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/obdecho/echo_client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdecho/echo_client.c +1 -4
@@ -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 )
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 9/24 staging: lustre: obdclass: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/obdclass/lu_object.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/lustre/lustre/obdclass/lu_object.c +1 -5
@@ -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);
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 10/24 staging: lustre: obdclass: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/obdclass/dt_object.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdclass/dt_object.c +1 -4
@@ -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 )
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 11/24 staging: lustre: mgc: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +1 -4
@@ -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)
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 12/24 staging: lustre: mdc: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -3
@@ -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 )
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 13/24 staging: lustre: mdc: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1 -3
@@ -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,
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 13/24] staging: lustre: mdc: remove unused variable
Quoted 29 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/lustre/lustre/mdc/mdc_locks.c +0
-0
drivers/staging/lustre/lustre/mdc/mdc_locks.c int mdc_cancel_unused(struct obd_export *exp, · line 182
Quoted 9 lines
drivers/staging/lustre/lustre/mdc/mdc_locks.c +1
-2@@ -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
Quoted 19 lines
drivers/staging/lustre/lustre/mdc/mdc_locks.c +0
-2-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 [email protected].
To post to this group, send email to [email protected].
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.
PATCH 14/24 staging: lustre: lov: remove unused variable
In reply to Aya MahfouzThis 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 <[email protected]> --- drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/lov/lov_obd.c +2 -3
@@ -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:
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 14/24] staging: lustre: lov: remove unused variable
Quoted 36 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-4-int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz <[email protected]> --- drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/lustre/lustre/lov/lov_obd.c +1
-1@@ -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;
drivers/staging/lustre/lustre/lov/lov_obd.c static int lov_disconnect(struct obd_export *exp) · line 343
Quoted 6 lines
drivers/staging/lustre/lustre/lov/lov_obd.c +1
-2@@ -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
Quoted 18 lines
drivers/staging/lustre/lustre/lov/lov_obd.c +0
-1}/* 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 [email protected].
To post to this group, send email to [email protected].
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.
Re: [Outreachy kernel] [PATCH 14/24] staging: lustre: lov: remove unused variable
Quoted 42 lines · Julia Lawall
Quoted 38 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-4-int len; ... when != len when strict -len = +return f(...); -return len; Signed-off-by: Aya Mahfouz <[email protected]> --- drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/lustre/lustre/lov/lov_obd.c +1
-1@@ -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);
Quoted 9 lines
drivers/staging/lustre/lustre/lov/lov_obd.c static int lov_disconnect(struct obd_export *exp) · line 343
Quoted 4 lines
drivers/staging/lustre/lustre/lov/lov_obd.c +1
-2out: - 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.
Quoted 18 lines
Quoted 18 lines
drivers/staging/lustre/lustre/lov/lov_obd.c +0
-1}/* 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 [email protected].
To post to this group, send email to [email protected].
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.
Signature · 2 lines
Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 15/24 staging: lustre: lmv: remove unused variables
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +2 -6
@@ -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 )
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Greg KH
maintainerRe: [Outreachy kernel] [PATCH 15/24] staging: lustre: lmv: remove unused variables
Quoted 29 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/staging/lustre/lustre/lmv/lmv_obd.c +0
-0
drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, · line 2559
Quoted 8 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1
-3@@ -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 :(
PATCH 16/24 staging: lustre: llite: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -4
@@ -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,
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 16/24] staging: lustre: llite: remove unused variable
Quoted 29 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/lustre/lustre/llite/vvp_io.c +0
-0
drivers/staging/lustre/lustre/llite/vvp_io.c static int vvp_io_read_lock(const struct lu_env *env, · line 314
Quoted 8 lines
drivers/staging/lustre/lustre/llite/vvp_io.c +1
-2@@ -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
Quoted 20 lines
drivers/staging/lustre/lustre/llite/vvp_io.c +0
-3- -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 [email protected].
To post to this group, send email to [email protected].
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.
PATCH 17/24 staging: lustre: llite: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/llite/lproc_llite.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/lproc_llite.c +1 -4
@@ -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,
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 18/24 staging: lustre: llite: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/llite/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +1 -3
@@ -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 */
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 18/24] staging: lustre: llite: remove unused variable
Quoted 37 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/lustre/lustre/llite/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/lustre/lustre/llite/file.c +0
-1@@ -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 ) {
drivers/staging/lustre/lustre/llite/file.c static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, · line 909
Quoted 6 lines
drivers/staging/lustre/lustre/llite/file.c +1
-1@@ -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
Quoted 19 lines
drivers/staging/lustre/lustre/llite/file.c +0
-2-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 [email protected].
To post to this group, send email to [email protected].
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.
Re: [Outreachy kernel] [PATCH 18/24] staging: lustre: llite: remove unused variable
Quoted 44 lines · Julia Lawall
Quoted 40 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/lustre/lustre/llite/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/staging/lustre/lustre/llite/file.c +0
-1@@ -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;
Quoted 7 lines
drivers/staging/lustre/lustre/llite/file.c static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, · line 909
Quoted 3 lines
drivers/staging/lustre/lustre/llite/file.c +1
-1- 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.
Quoted 21 lines
julia
Quoted 19 lines
drivers/staging/lustre/lustre/llite/file.c +0
-2-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 [email protected].
To post to this group, send email to [email protected].
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.
Signature · 2 lines
Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 19/24 staging: lustre: llite: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/lustre/lustre/llite/dcache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +1 -4
@@ -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); }
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 20/24 staging: iio: meter: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/iio/meter/ade7759.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/iio/meter/ade7759.c +1 -4
@@ -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);
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 21/24 staging: iio: meter: remove unused variables
In reply to Aya MahfouzThis 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;
--- drivers/staging/iio/meter/ade7758_core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/iio/meter/ade7758_core.c +2 -8
@@ -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)
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
Quoted 32 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/iio/meter/ade7758_core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/iio/meter/ade7758_core.c +0
-1@@ -300,18 +300,15 @@ error_ret:static int ade7758_reset (struct device *dev) { -int ret;
drivers/staging/iio/meter/ade7758_core.c error_ret: · line 311
Quoted 10 lines
drivers/staging/iio/meter/ade7758_core.c +1
-1u8 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
Quoted 40 lines
drivers/staging/iio/meter/ade7758_core.c +1
-7- -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 [email protected].
To post to this group, send email to [email protected].
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.
Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
In reply to Aya MahfouzQuoted 56 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/iio/meter/ade7758_core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/iio/meter/ade7758_core.c +1
-5@@ -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,
drivers/staging/iio/meter/ade7758_core.c error_ret: · line 451
Quoted 10 lines
drivers/staging/iio/meter/ade7758_core.c +1
-3&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.
Re: [Outreachy kernel] [PATCH 21/24] staging: iio: meter: remove unused variables
Quoted 56 lines · Daniel Baluta
Quoted 54 lines · Aya Mahfouz
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;
@@(quoted diff) +1
-3-int len; ... when != len when strict -len = +return f(...); -return len;Signed-off-by Aya Mahfouz <[email protected]>--- drivers/staging/iio/meter/ade7758_core.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/staging/iio/meter/ade7758_core.c +1
-5@@ -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;
Quoted 16 lines
drivers/staging/iio/meter/ade7758_core.c error_ret: · line 451
Quoted 12 lines
drivers/staging/iio/meter/ade7758_core.c +1
-3ade7758_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.
Quoted 1 line
Daniel.
Signature · 2 lines
Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 22/24 staging: iio: light: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/iio/light/tsl2583.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/iio/light/tsl2583.c +1 -3
@@ -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 */
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 23/24 staging: fbtft: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/fbtft/fbtft-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/fbtft/fbtft-core.c +1 -3
@@ -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);
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz
PATCH 24/24 staging: dgap: remove unused variable
In reply to Aya MahfouzThis 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;
--- drivers/staging/dgap/dgap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/dgap/dgap.c +1 -4
@@ -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); }/*
Signature · 6 lines
1.9.3 -- Kind Regards, Aya Saif El-yazal Mahfouz