These patches remove initializations of variables that are immediately
reassigned.
Remove initialization of a variable that is immediately reassigned.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@
T x
- = C
;
x = e;
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/staging/lustre/lustre/libcfs/fail.c | 2 +-
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c
@@ -78,7 +78,7 @@ EXPORT_SYMBOL(cfs_cpt_table_free);
int
cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
{
- int rc = 0;
+ int rc;
rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
len -= rc;
diff -u -p a/drivers/staging/lustre/lustre/libcfs/fail.c b/drivers/staging/lustre/lustre/libcfs/fail.c
--- a/drivers/staging/lustre/lustre/libcfs/fail.c
+++ b/drivers/staging/lustre/lustre/libcfs/fail.c
@@ -123,7 +123,7 @@ EXPORT_SYMBOL(__cfs_fail_check_set);
int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
{
- int ret = 0;
+ int ret;
ret = __cfs_fail_check_set(id, value, set);
if (ret) {
Remove initialization of a variable that is immediately reassigned.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@
T x
- = C
;
x = e;
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/staging/lustre/lustre/llite/file.c | 2 +-
drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c
--- a/drivers/staging/lustre/lustre/llite/xattr_cache.c
+++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c
@@ -357,7 +357,7 @@ static int ll_xattr_cache_refill(struct
struct ll_inode_info *lli = ll_i2info(inode);
struct mdt_body *body;
__u32 *xsizes;
- int rc = 0, i;
+ int rc, i;
diff -u -p a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3005,7 +3005,7 @@ int ll_getattr(struct vfsmount *mnt, str
struct inode *inode = d_inode(de);
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ll_inode_info *lli = ll_i2info(inode);
- int res = 0;
+ int res;
res = ll_inode_revalidate(de, MDS_INODELOCK_UPDATE |
MDS_INODELOCK_LOOKUP);
Remove initialization of a variable that is immediately reassigned.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@
T x
- = C
;
x = e;
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1993,7 +1993,7 @@ static int lmv_setattr(struct obd_export
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct lmv_tgt_desc *tgt;
- int rc = 0;
+ int rc;
rc = lmv_check_connect(obd);
if (rc)
Remove initialization of a variable that is immediately reassigned.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@
T x
- = C
;
x = e;
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/staging/lustre/lustre/obdclass/llog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c
--- a/drivers/staging/lustre/lustre/obdclass/llog.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog.c
@@ -907,7 +907,7 @@ int llog_is_empty(const struct lu_env *e
char *name)
{
struct llog_handle *llh;
- int rc = 0;
+ int rc;
rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
if (rc < 0) {
Remove initialization of a variable that is immediately reassigned.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
identifier x;
constant C;
expression e;
@@
T x
- = C
;
x = e;
// </smpl>
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/staging/lustre/lustre/osc/osc_page.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c
--- a/drivers/staging/lustre/lustre/osc/osc_page.c
+++ b/drivers/staging/lustre/lustre/osc/osc_page.c
@@ -471,7 +471,7 @@ static int osc_page_flush(const struct l
struct cl_io *io)
{
struct osc_page *opg = cl2osc_page(slice);
- int rc = 0;
+ int rc;
rc = osc_flush_async_page(env, io, opg);
return rc;
On 20 June 2015 at 21:07, Julia Lawall <[email protected]> wrote:
> Remove initialization of a variable that is immediately reassigned.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> type T;
> identifier x;
> constant C;
> expression e;
> @@
>
> T x
> - = C
> ;
> x = e;
> // </smpl>
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> drivers/staging/lustre/lustre/osc/osc_page.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -u -p a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c
> --- a/drivers/staging/lustre/lustre/osc/osc_page.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_page.c
> @@ -471,7 +471,7 @@ static int osc_page_flush(const struct l
> struct cl_io *io)
> {
> struct osc_page *opg = cl2osc_page(slice);
> - int rc = 0;
> + int rc;
>
> rc = osc_flush_async_page(env, io, opg);
> return rc;
>
The whole rc variable is kinda useless.
Why not make it just:
return osc_flush_async_page(env, io, opg);
regards,
Joachim Eastwood
On Sat, 20 Jun 2015, Joachim Eastwood wrote:
> On 20 June 2015 at 21:07, Julia Lawall <[email protected]> wrote:
> > Remove initialization of a variable that is immediately reassigned.
> >
> > The semantic patch that makes this change is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > // <smpl>
> > @@
> > type T;
> > identifier x;
> > constant C;
> > expression e;
> > @@
> >
> > T x
> > - = C
> > ;
> > x = e;
> > // </smpl>
> >
> > Signed-off-by: Julia Lawall <[email protected]>
> >
> > ---
> > drivers/staging/lustre/lustre/osc/osc_page.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff -u -p a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c
> > --- a/drivers/staging/lustre/lustre/osc/osc_page.c
> > +++ b/drivers/staging/lustre/lustre/osc/osc_page.c
> > @@ -471,7 +471,7 @@ static int osc_page_flush(const struct l
> > struct cl_io *io)
> > {
> > struct osc_page *opg = cl2osc_page(slice);
> > - int rc = 0;
> > + int rc;
> >
> > rc = osc_flush_async_page(env, io, opg);
> > return rc;
> >
>
> The whole rc variable is kinda useless.
>
> Why not make it just:
> return osc_flush_async_page(env, io, opg);
Sure. I'll fix that.
julia