2017-01-06 15:20:56

by Rahul Krishnan

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

This patch removes unnecessary return statement using spatch.
Signed-off-by: Rahul Krishnan <[email protected]>
---
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


2017-01-06 23:31:49

by Michael Büsch

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

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


Attachments:
(No filename) (833.00 B)
OpenPGP digital signature

2017-01-06 22:40:16

by Rafał Miłecki

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

On 6 January 2017 at 23:39, Rafa=C5=82 Mi=C5=82ecki <[email protected]> wrot=
e:
> On 6 January 2017 at 16:20, Rahul Krishnan <[email protected]> wr=
ote:
>> This patch removes unnecessary return statement using spatch.
>> Signed-off-by: Rahul Krishnan <[email protected]>

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

2017-01-07 13:49:48

by kernel test robot

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

Hi Rahul,

[auto build test WARNING on linus/master]
[also build test WARNING 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: i386-randconfig-r0-201701 (attached as .config)
compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (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 <[email protected]>
^
In file included from include/linux/ioport.h:12:0,
from include/linux/device.h:16,
from include/linux/ssb/ssb.h:4,
from drivers/ssb/ssb_private.h:4,
from drivers/ssb/main.c:11:
>> include/linux/compiler.h:110:34: warning: 'struct ftrace_branch_data' declared inside parameter list
void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
^
>> include/linux/compiler.h:110:34: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/err.h: In function 'IS_ERR':
include/linux/compiler.h:117:18: error: variable '______f' has initializer but incomplete type
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/compiler.h:117:18: error: unknown field 'func' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/compiler.h:121:13: warning: excess elements in struct initializer
.func = __func__, \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/compiler.h:121:13: note: (near initialization for '______f')
.func = __func__, \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/compiler.h:117:18: error: unknown field 'file' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:35:40: warning: excess elements in struct initializer
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:35:40: note: (near initialization for '______f')
include/linux/compiler.h:117:18: error: unknown field 'line' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:35:40: warning: excess elements in struct initializer
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:35:40: note: (near initialization for '______f')
include/linux/compiler.h:120:5: error: storage size of '______f' isn't known
______f = { \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
include/linux/err.h:35:9: note: in expansion of macro 'IS_ERR_VALUE'
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/compiler.h:120:5: warning: unused variable '______f' [-Wunused-variable]
______f = { \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
include/linux/err.h:21:25: note: in expansion of macro 'unlikely'
--
^
include/linux/compiler.h:121:13: note: (near initialization for '______f')
.func = __func__, \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
arch/x86/include/asm/preempt.h:98:9: note: in expansion of macro 'unlikely'
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
include/linux/compiler.h:117:18: error: unknown field 'file' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
arch/x86/include/asm/preempt.h:98:9: note: in expansion of macro 'unlikely'
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
arch/x86/include/asm/preempt.h:98:67: warning: excess elements in struct initializer
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
arch/x86/include/asm/preempt.h:98:67: note: (near initialization for '______f')
include/linux/compiler.h:117:18: error: unknown field 'line' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
arch/x86/include/asm/preempt.h:98:9: note: in expansion of macro 'unlikely'
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
arch/x86/include/asm/preempt.h:98:67: warning: excess elements in struct initializer
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
arch/x86/include/asm/preempt.h:98:67: note: (near initialization for '______f')
include/linux/compiler.h:120:5: error: storage size of '______f' isn't known
______f = { \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
arch/x86/include/asm/preempt.h:98:9: note: in expansion of macro 'unlikely'
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
include/linux/compiler.h:120:5: warning: unused variable '______f' [-Wunused-variable]
______f = { \
^
include/linux/compiler.h:139:58: note: in expansion of macro '__branch_check__'
# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
^
arch/x86/include/asm/preempt.h:98:9: note: in expansion of macro 'unlikely'
return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset);
^
include/asm-generic/qspinlock.h: In function 'queued_spin_lock':
include/linux/compiler.h:117:18: error: variable '______f' has initializer but incomplete type
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/linux/compiler.h:117:18: error: unknown field 'func' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/linux/compiler.h:121:13: warning: excess elements in struct initializer
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/linux/compiler.h:121:13: note: (near initialization for '______f')
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/linux/compiler.h:117:18: error: unknown field 'file' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
>> include/asm-generic/qspinlock.h:101:21: warning: excess elements in struct initializer
if (likely(val == 0))
^
include/asm-generic/qspinlock.h:101:21: note: (near initialization for '______f')
include/linux/compiler.h:117:18: error: unknown field 'line' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
>> include/asm-generic/qspinlock.h:101:21: warning: excess elements in struct initializer
if (likely(val == 0))
^
include/asm-generic/qspinlock.h:101:21: note: (near initialization for '______f')
include/linux/compiler.h:120:5: error: storage size of '______f' isn't known
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/linux/compiler.h:120:5: warning: unused variable '______f' [-Wunused-variable]
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qspinlock.h:101:6: note: in expansion of macro 'likely'
if (likely(val == 0))
^
include/asm-generic/qrwlock.h: In function 'queued_read_trylock':
include/linux/compiler.h:117:18: error: variable '______f' has initializer but incomplete type
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:117:18: error: unknown field 'func' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:121:13: warning: excess elements in struct initializer
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:121:13: note: (near initialization for '______f')
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:117:18: error: unknown field 'file' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
>> include/asm-generic/qrwlock.h:83:32: warning: excess elements in struct initializer
if (likely(!(cnts & _QW_WMASK))) {
^
include/asm-generic/qrwlock.h:83:32: note: (near initialization for '______f')
include/linux/compiler.h:117:18: error: unknown field 'line' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
>> include/asm-generic/qrwlock.h:83:32: warning: excess elements in struct initializer
if (likely(!(cnts & _QW_WMASK))) {
^
include/asm-generic/qrwlock.h:83:32: note: (near initialization for '______f')
include/linux/compiler.h:120:5: error: storage size of '______f' isn't known
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:120:5: warning: unused variable '______f' [-Wunused-variable]
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:83:6: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK))) {
^
include/linux/compiler.h:117:18: error: variable '______f' has initializer but incomplete type
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/linux/compiler.h:117:18: error: unknown field 'func' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/linux/compiler.h:121:13: warning: excess elements in struct initializer
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/linux/compiler.h:121:13: note: (near initialization for '______f')
.func = __func__, \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/linux/compiler.h:117:18: error: unknown field 'file' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/asm-generic/qrwlock.h:85:33: warning: excess elements in struct initializer
if (likely(!(cnts & _QW_WMASK)))
^
include/asm-generic/qrwlock.h:85:33: note: (near initialization for '______f')
include/linux/compiler.h:117:18: error: unknown field 'line' specified in initializer
static struct ftrace_branch_data \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/asm-generic/qrwlock.h:85:33: warning: excess elements in struct initializer
if (likely(!(cnts & _QW_WMASK)))
^
include/asm-generic/qrwlock.h:85:33: note: (near initialization for '______f')
include/linux/compiler.h:120:5: error: storage size of '______f' isn't known
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
^
include/linux/compiler.h:120:5: warning: unused variable '______f' [-Wunused-variable]
______f = { \
^
include/linux/compiler.h:136:56: note: in expansion of macro '__branch_check__'
# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
^
include/asm-generic/qrwlock.h:85:7: note: in expansion of macro 'likely'
if (likely(!(cnts & _QW_WMASK)))
..

vim +212 drivers/ssb/main.c

3ba6018a Michael Buesch 2009-11-23 196 *
3ba6018a Michael Buesch 2009-11-23 197 * After freezing no device driver will be handling a device
3ba6018a Michael Buesch 2009-11-23 198 * on this bus anymore. ssb_devices_thaw() must be called after
3ba6018a Michael Buesch 2009-11-23 199 * a successful freeze to reactivate the devices.
3ba6018a Michael Buesch 2009-11-23 200 *
3ba6018a Michael Buesch 2009-11-23 201 * @bus: The bus.
3ba6018a Michael Buesch 2009-11-23 202 * @ctx: Context structure. Pass this to ssb_devices_thaw().
3ba6018a Michael Buesch 2009-11-23 203 */
3ba6018a Michael Buesch 2009-11-23 204 int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
61e115a5 Michael Buesch 2007-09-18 205 {
3ba6018a Michael Buesch 2009-11-23 206 struct ssb_device *sdev;
3ba6018a Michael Buesch 2009-11-23 207 struct ssb_driver *sdrv;
3ba6018a Michael Buesch 2009-11-23 208 unsigned int i;
3ba6018a Michael Buesch 2009-11-23 209
3ba6018a Michael Buesch 2009-11-23 210 memset(ctx, 0, sizeof(*ctx));
3ba6018a Michael Buesch 2009-11-23 211 ctx->bus = bus;
3ba6018a Michael Buesch 2009-11-23 @212 SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen));
61e115a5 Michael Buesch 2007-09-18 213
61e115a5 Michael Buesch 2007-09-18 214 for (i = 0; i < bus->nr_devices; i++) {
3ba6018a Michael Buesch 2009-11-23 215 sdev = ssb_device_get(&bus->devices[i]);
3ba6018a Michael Buesch 2009-11-23 216
3ba6018a Michael Buesch 2009-11-23 217 if (!sdev->dev || !sdev->dev->driver ||
3ba6018a Michael Buesch 2009-11-23 218 !device_is_registered(sdev->dev)) {
3ba6018a Michael Buesch 2009-11-23 219 ssb_device_put(sdev);
61e115a5 Michael Buesch 2007-09-18 220 continue;

:::::: The code at line 212 was first introduced by commit
:::::: 3ba6018aa314559c5867138a8173b068268a70db ssb: Fix SPROM writing

:::::: TO: Michael Buesch <[email protected]>
:::::: CC: John W. Linville <[email protected]>

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


Attachments:
(No filename) (25.62 kB)
.config.gz (21.29 kB)
Download all attachments

2017-01-07 13:39:56

by kernel test robot

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

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 <[email protected]>
^

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 <[email protected]>
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


Attachments:
(No filename) (1.40 kB)
.config.gz (27.27 kB)
Download all attachments

2017-01-06 22:39:21

by Rafał Miłecki

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

Hi Rahul,

On 6 January 2017 at 16:20, Rahul Krishnan <[email protected]> wrot=
e:
> This patch removes unnecessary return statement using spatch.
> Signed-off-by: Rahul Krishnan <[email protected]>

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 =3D (1 << (size + 1));
> -
> - return size;
> + return (1 << (size + 1));
> }
> EXPORT_SYMBOL(ssb_admatch_size);

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

--=20
Rafa=C5=82

2017-01-07 00:52:56

by Julian Calaby

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

Hi Rahul,

On Sat, Jan 7, 2017 at 2:20 AM, Rahul Krishnan
<[email protected]> wrote:
> This patch removes unnecessary return statement using spatch.

This doesn't describe the patch.

> Signed-off-by: Rahul Krishnan <[email protected]>
> ---
> 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: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/