Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1552874 > unrolled thread

[PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

Started byRahul Krishnan <mrahul.krishnan@gmail.com>
First post2017-01-06 16:30 +0100
Last post2017-01-07 14:50 +0100
Articles 6 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ssb: main.c: This patch removes unnecessary return statement  using spatch tool Rahul Krishnan <mrahul.krishnan@gmail.com> - 2017-01-06 16:30 +0100
    Re: [PATCH] ssb: main.c: This patch removes unnecessary return  statement using spatch tool Rafał Miłecki <zajec5@gmail.com> - 2017-01-06 23:40 +0100
      Re: [PATCH] ssb: main.c: This patch removes unnecessary return  statement using spatch tool Rafał Miłecki <zajec5@gmail.com> - 2017-01-06 23:50 +0100
      Re: [PATCH] ssb: main.c: This patch removes unnecessary return  statement using spatch tool Michael Büsch <m@bues.ch> - 2017-01-07 00:40 +0100
    Re: [PATCH] ssb: main.c: This patch removes unnecessary return  statement using spatch tool Julian Calaby <julian.calaby@gmail.com> - 2017-01-07 02:00 +0100
    Re: [PATCH] ssb: main.c: This patch removes unnecessary return  statement using spatch tool kbuild test robot <lkp@intel.com> - 2017-01-07 14:50 +0100

#1552874 — [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

FromRahul Krishnan <mrahul.krishnan@gmail.com>
Date2017-01-06 16:30 +0100
Subject[PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWECR-3O1-11@gated-at.bofh.it>
This patch removes unnecessary return statement using spatch.
Signed-off-by: Rahul Krishnan <mrahul.krishnan@gmail.com>
---
 drivers/ssb/main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index d1a7507..ae3b7fe 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1,4 +1,4 @@
-/*
+ patch /home/rahul/git/kernels/staging/drivers//*
  * Sonics Silicon Backplane
  * Subsystem core
  *
@@ -1272,9 +1272,7 @@ u32 ssb_admatch_size(u32 adm)
 	default:
 		SSB_WARN_ON(1);
 	}
-	size = (1 << (size + 1));
-
-	return size;
+	return (1 << (size + 1));
 }
 EXPORT_SYMBOL(ssb_admatch_size);
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1553361 — Re: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

FromRafał Miłecki <zajec5@gmail.com>
Date2017-01-06 23:40 +0100
SubjectRe: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWLl0-8sx-31@gated-at.bofh.it>
In reply to#1552874
Hi Rahul,

On 6 January 2017 at 16:20, Rahul Krishnan <mrahul.krishnan@gmail.com> wrote:
> This patch removes unnecessary return statement using spatch.
> Signed-off-by: Rahul Krishnan <mrahul.krishnan@gmail.com>

Please work on simplifying & making topic more accurate.

You can drop "main.c:" and "This patch".

I don't think this patch really "removes unnecessary return". It looks
like you just dropped assignment/calculation done just before
returning value. That "using spatch tool" part is also misleading. You
don't really use that tool for removing it. More likely it was
noticed/suggested that that tool you use.

Please use commit message for describing your change and don't just
copy & paste topic. You can e.g. put into about "spatch" there
(instead of the topic).


> @@ -1,4 +1,4 @@
> -/*
> + patch /home/rahul/git/kernels/staging/drivers//*
>   * Sonics Silicon Backplane
>   * Subsystem core
>   *

Huh? Looks definitely wrong and I don't think it even compiles
anymore! Make sure to compile code after your change, to make sure it
does & there isn't any new warning.


> @@ -1272,9 +1272,7 @@ u32 ssb_admatch_size(u32 adm)
>         default:
>                 SSB_WARN_ON(1);
>         }
> -       size = (1 << (size + 1));
> -
> -       return size;
> +       return (1 << (size + 1));
>  }
>  EXPORT_SYMBOL(ssb_admatch_size);

Please rework your patch, *test it* and resend V2.

-- 
Rafał

[toc] | [prev] | [next] | [standalone]


#1553386 — Re: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

FromRafał Miłecki <zajec5@gmail.com>
Date2017-01-06 23:50 +0100
SubjectRe: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWLuG-4T-19@gated-at.bofh.it>
In reply to#1553361
On 6 January 2017 at 23:39, Rafał Miłecki <zajec5@gmail.com> wrote:
> On 6 January 2017 at 16:20, Rahul Krishnan <mrahul.krishnan@gmail.com> wrote:
>> This patch removes unnecessary return statement using spatch.
>> Signed-off-by: Rahul Krishnan <mrahul.krishnan@gmail.com>

Also an extra line break above Signed-off-by is preferred. Look at
"git log" to get am overview.

[toc] | [prev] | [next] | [standalone]


#1553504 — Re: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

FromMichael Büsch <m@bues.ch>
Date2017-01-07 00:40 +0100
SubjectRe: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWMh4-Fc-21@gated-at.bofh.it>
In reply to#1553361

[Multipart message — attachments visible in raw view] — view raw

> > @@ -1272,9 +1272,7 @@ u32 ssb_admatch_size(u32 adm)
> >         default:
> >                 SSB_WARN_ON(1);
> >         }
> > -       size = (1 << (size + 1));
> > -
> > -       return size;
> > +       return (1 << (size + 1));
> >  }
> >  EXPORT_SYMBOL(ssb_admatch_size);  

I'm all for cleaning up code, but I don't really see how this
change improves the code.

-- 
Michael

[toc] | [prev] | [next] | [standalone]


#1553522 — Re: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

FromJulian Calaby <julian.calaby@gmail.com>
Date2017-01-07 02:00 +0100
SubjectRe: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWNwt-1nt-7@gated-at.bofh.it>
In reply to#1552874
Hi Rahul,

On Sat, Jan 7, 2017 at 2:20 AM, Rahul Krishnan
<mrahul.krishnan@gmail.com> wrote:
> This patch removes unnecessary return statement using spatch.

This doesn't describe the patch.

> Signed-off-by: Rahul Krishnan <mrahul.krishnan@gmail.com>
> ---
>  drivers/ssb/main.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
> index d1a7507..ae3b7fe 100644
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -1,4 +1,4 @@
> -/*
> + patch /home/rahul/git/kernels/staging/drivers//*

What is the purpose of this change, won't this cause the file to fail
to compile?

>   * Sonics Silicon Backplane
>   * Subsystem core
>   *
> @@ -1272,9 +1272,7 @@ u32 ssb_admatch_size(u32 adm)
>         default:
>                 SSB_WARN_ON(1);
>         }
> -       size = (1 << (size + 1));
> -
> -       return size;
> +       return (1 << (size + 1));

Is the size variable used elsewhere? If not, it's declaration should
probably be removed.

Also, there should be a blank line before the return statement.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

[toc] | [prev] | [next] | [standalone]


#1553660 — Re: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool

Fromkbuild test robot <lkp@intel.com>
Date2017-01-07 14:50 +0100
SubjectRe: [PATCH] ssb: main.c: This patch removes unnecessary return statement using spatch tool
Message-ID<sWZxE-13b-21@gated-at.bofh.it>
In reply to#1552874

[Multipart message — attachments visible in raw view] — view raw

Hi Rahul,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc2 next-20170106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Rahul-Krishnan/ssb-main-c-This-patch-removes-unnecessary-return-statement-using-spatch-tool/20170107-205451
config: x86_64-randconfig-x008-201701 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/ssb/main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '/' token
     patch /home/rahul/git/kernels/staging/drivers//*
           ^
>> drivers/ssb/main.c:6:43: error: stray '@' in program
     * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
                                              ^

vim +1 drivers/ssb/main.c

   > 1	 patch /home/rahul/git/kernels/staging/drivers//*
     2	 * Sonics Silicon Backplane
     3	 * Subsystem core
     4	 *
     5	 * Copyright 2005, Broadcom Corporation
   > 6	 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
     7	 *
     8	 * Licensed under the GNU/GPL. See COPYING for details.
     9	 */

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web