mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] drop trivially useless initialization
@ 2015-06-20 19:07 Julia Lawall
  2015-06-20 19:07 ` [PATCH 1/5] staging: lustre: libcfs: " Julia Lawall
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, devel, HPDD-discuss, Greg Kroah-Hartman,
	Andreas Dilger, Oleg Drokin

These patches remove initializations of variables that are immediately
reassigned.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] staging: lustre: libcfs: drop trivially useless initialization
  2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
@ 2015-06-20 19:07 ` Julia Lawall
  2015-06-20 19:07 ` [PATCH 2/5] staging: lustre: llite: " Julia Lawall
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

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 <Julia.Lawall@lip6.fr>

---
 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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/5] staging: lustre: llite: drop trivially useless initialization
  2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
  2015-06-20 19:07 ` [PATCH 1/5] staging: lustre: libcfs: " Julia Lawall
@ 2015-06-20 19:07 ` Julia Lawall
  2015-06-20 19:07 ` [PATCH 3/5] staging: lustre: lmv: " Julia Lawall
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

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 <Julia.Lawall@lip6.fr>

---
 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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] staging: lustre: lmv: drop trivially useless initialization
  2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
  2015-06-20 19:07 ` [PATCH 1/5] staging: lustre: libcfs: " Julia Lawall
  2015-06-20 19:07 ` [PATCH 2/5] staging: lustre: llite: " Julia Lawall
@ 2015-06-20 19:07 ` Julia Lawall
  2015-06-20 19:07 ` [PATCH 4/5] staging: lustre: obdclass: llog: " Julia Lawall
  2015-06-20 19:07 ` [PATCH 5/5] staging: lustre: osc: " Julia Lawall
  4 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

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 <Julia.Lawall@lip6.fr>

---
 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/5] staging: lustre: obdclass: llog: drop trivially useless initialization
  2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
                   ` (2 preceding siblings ...)
  2015-06-20 19:07 ` [PATCH 3/5] staging: lustre: lmv: " Julia Lawall
@ 2015-06-20 19:07 ` Julia Lawall
  2015-06-20 19:07 ` [PATCH 5/5] staging: lustre: osc: " Julia Lawall
  4 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

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 <Julia.Lawall@lip6.fr>

---
 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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] staging: lustre: osc: drop trivially useless initialization
  2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
                   ` (3 preceding siblings ...)
  2015-06-20 19:07 ` [PATCH 4/5] staging: lustre: obdclass: llog: " Julia Lawall
@ 2015-06-20 19:07 ` Julia Lawall
  2015-06-20 21:44   ` Joachim Eastwood
  4 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-06-20 19:07 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

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 <Julia.Lawall@lip6.fr>

---
 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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] staging: lustre: osc: drop trivially useless initialization
  2015-06-20 19:07 ` [PATCH 5/5] staging: lustre: osc: " Julia Lawall
@ 2015-06-20 21:44   ` Joachim Eastwood
  2015-06-21  0:49     ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Joachim Eastwood @ 2015-06-20 21:44 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Oleg Drokin, kernel-janitors, Andreas Dilger, Greg Kroah-Hartman,
	HPDD-discuss, devel, linux-kernel

On 20 June 2015 at 21:07, Julia Lawall <Julia.Lawall@lip6.fr> 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 <Julia.Lawall@lip6.fr>
>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] staging: lustre: osc: drop trivially useless initialization
  2015-06-20 21:44   ` Joachim Eastwood
@ 2015-06-21  0:49     ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-06-21  0:49 UTC (permalink / raw)
  To: Joachim Eastwood
  Cc: Julia Lawall, Oleg Drokin, kernel-janitors, Andreas Dilger,
	Greg Kroah-Hartman, HPDD-discuss, devel, linux-kernel

On Sat, 20 Jun 2015, Joachim Eastwood wrote:

> On 20 June 2015 at 21:07, Julia Lawall <Julia.Lawall@lip6.fr> 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 <Julia.Lawall@lip6.fr>
> >
> > ---
> >  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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-21  0:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-20 19:07 [PATCH 0/5] drop trivially useless initialization Julia Lawall
2015-06-20 19:07 ` [PATCH 1/5] staging: lustre: libcfs: " Julia Lawall
2015-06-20 19:07 ` [PATCH 2/5] staging: lustre: llite: " Julia Lawall
2015-06-20 19:07 ` [PATCH 3/5] staging: lustre: lmv: " Julia Lawall
2015-06-20 19:07 ` [PATCH 4/5] staging: lustre: obdclass: llog: " Julia Lawall
2015-06-20 19:07 ` [PATCH 5/5] staging: lustre: osc: " Julia Lawall
2015-06-20 21:44   ` Joachim Eastwood
2015-06-21  0:49     ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®