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


Groups > linux.kernel > #1238277 > unrolled thread

[PATCH 00/18] Input - Fix make coccicheck warnings

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2015-10-02 15:50 +0200
Last post2015-10-03 13:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/18] Input - Fix make coccicheck warnings Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 15:50 +0200
    [PATCH 14/18] Input: synaptics_i2c - simplify function return logic Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 15:50 +0200
    Re: [PATCH 00/18] Input - Fix make coccicheck warnings Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-10-02 20:30 +0200
      Re: [PATCH 00/18] Input - Fix make coccicheck warnings Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-03 13:20 +0200

#1238277 — [PATCH 00/18] Input - Fix make coccicheck warnings

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2015-10-02 15:50 +0200
Subject[PATCH 00/18] Input - Fix make coccicheck warnings
Message-ID<qf8SJ-4YE-7@gated-at.bofh.it>
Hello Dmitry,

This series contains trivial patches with fixes to different warnings
reported by make coccichek M=drivers/input.

The patches don't contain functional changes but makes the functions
simpler and removes unnecessary lines of code.

Best regards,
Javier


Javier Martinez Canillas (18):
  Input: joydev - use memdup_user() to duplicate memory from user-space
  Input: ads7846 - use PTR_ERR_OR_ZERO()
  Input: cyttsp - use PTR_ERR_OR_ZERO()
  Input: kxtj9 - remove unneeded retval variable
  Input: retu-pwrbutton - simplify function return logic
  Input: zforce - simplify function return logic
  Input: cap11xx - simplify function return logic
  Input: goldfish - simplify function return logic
  Input: jornada720_ts - simplify function return logic
  Input: intel-mid-touch - simplify function return logic
  Input: da9034-ts - simplify function return logic
  Input: pxa27x_keypad - simplify function return logic
  Input: atmel_mxt_ts - simplify function return logic
  Input: synaptics_i2c - simplify function return logic
  Input: auo-pixcir-ts - simplify function return logic
  Input: elan_i2c - simplify function return logic
  Input: cypress_ps2 - simplify function return logic
  Input: tps6507x-ts - simplify function return logic

 drivers/input/joydev.c                      | 18 ++++++-----------
 drivers/input/keyboard/cap11xx.c            |  8 ++------
 drivers/input/keyboard/goldfish_events.c    |  6 +-----
 drivers/input/keyboard/pxa27x_keypad.c      | 12 ++++--------
 drivers/input/misc/kxtj9.c                  |  3 +--
 drivers/input/misc/retu-pwrbutton.c         |  6 +-----
 drivers/input/mouse/cypress_ps2.c           |  6 +-----
 drivers/input/mouse/elan_i2c_smbus.c        |  6 +-----
 drivers/input/mouse/synaptics_i2c.c         |  6 +-----
 drivers/input/touchscreen/ads7846.c         |  4 +---
 drivers/input/touchscreen/atmel_mxt_ts.c    | 30 +++++------------------------
 drivers/input/touchscreen/auo-pixcir-ts.c   |  7 +------
 drivers/input/touchscreen/cyttsp4_i2c.c     |  5 +----
 drivers/input/touchscreen/da9034-ts.c       |  7 +------
 drivers/input/touchscreen/intel-mid-touch.c |  6 +-----
 drivers/input/touchscreen/jornada720_ts.c   |  6 +-----
 drivers/input/touchscreen/tps6507x-ts.c     |  9 +--------
 drivers/input/touchscreen/zforce_ts.c       |  7 +------
 18 files changed, 31 insertions(+), 121 deletions(-)

-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1238278 — [PATCH 14/18] Input: synaptics_i2c - simplify function return logic

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2015-10-02 15:50 +0200
Subject[PATCH 14/18] Input: synaptics_i2c - simplify function return logic
Message-ID<qf8SM-4YE-87@gated-at.bofh.it>
In reply to#1238277
The invoked function already returns zero on success or a negative
errno code so there is no need to open code the logic in the caller.

This also fixes the following make coccicheck warnings:

drivers/input/mouse/synaptics_i2c.c:298:1-4: WARNING: end returns can be simplified

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/input/mouse/synaptics_i2c.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index aa7c5da60800..9f69ce3de2f3 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -295,11 +295,7 @@ static int synaptics_i2c_config(struct i2c_client *client)
 	control |= reduce_report ? 1 << REDUCE_REPORTING : 0;
 	/* No Filter */
 	control |= no_filter ? 1 << NO_FILTER : 0;
-	ret = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control);
-	if (ret)
-		return ret;
-
-	return 0;
+	return synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control);
 }
 
 static int synaptics_i2c_reset_config(struct i2c_client *client)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1238510

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2015-10-02 20:30 +0200
Message-ID<qfdfI-2Wl-13@gated-at.bofh.it>
In reply to#1238277
Hi Javier,

On Fri, Oct 02, 2015 at 03:40:11PM +0200, Javier Martinez Canillas wrote:
> Hello Dmitry,
> 
> This series contains trivial patches with fixes to different warnings
> reported by make coccichek M=drivers/input.
> 
> The patches don't contain functional changes but makes the functions
> simpler and removes unnecessary lines of code.

I disagree with some "simplify function return logic" patches: when
there are several actions that may fail I prefer explicit:

	error = actionN();
	if (error)
		return error;

	return 0;

even on the last one as it keep with the code flow and makes it easier
to move stuff around.

Please consider patches that not explicitly replied to as applied a
dropped.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1238817

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2015-10-03 13:20 +0200
Message-ID<qft18-cq-17@gated-at.bofh.it>
In reply to#1238510
Hello Dmitry,

On 10/02/2015 08:25 PM, Dmitry Torokhov wrote:
> Hi Javier,
> 
> On Fri, Oct 02, 2015 at 03:40:11PM +0200, Javier Martinez Canillas wrote:
>> Hello Dmitry,
>>
>> This series contains trivial patches with fixes to different warnings
>> reported by make coccichek M=drivers/input.
>>
>> The patches don't contain functional changes but makes the functions
>> simpler and removes unnecessary lines of code.
> 
> I disagree with some "simplify function return logic" patches: when
> there are several actions that may fail I prefer explicit:
> 
> 	error = actionN();
> 	if (error)
> 		return error;
> 
> 	return 0;
> 
> even on the last one as it keep with the code flow and makes it easier
> to move stuff around.
>
> Please consider patches that not explicitly replied to as applied a
> dropped.

Thanks a lot for taking the time to explain this. I understand your
rationale and I tend to agree.

I'll see if the scripts/coccinelle/misc/simple_return.cocci semantic
patch can be modified to take this into account and not report a
warning for that pattern.

> 
> Thanks.
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web