Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1238247 > unrolled thread
| Started by | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| First post | 2015-10-02 15:50 +0200 |
| Last post | 2015-10-02 20:20 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 07/18] Input: cap11xx - simplify function return logic Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 15:50 +0200
Re: [PATCH 07/18] Input: cap11xx - simplify function return logic Daniel Mack <daniel@zonque.org> - 2015-10-02 15:50 +0200
Re: [PATCH 07/18] Input: cap11xx - simplify function return logic Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-10-02 20:10 +0200
Re: [PATCH 07/18] Input: cap11xx - simplify function return logic Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 20:20 +0200
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2015-10-02 15:50 +0200 |
| Subject | [PATCH 07/18] Input: cap11xx - simplify function return logic |
| Message-ID | <qf8SJ-4YE-5@gated-at.bofh.it> |
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 warning:
drivers/input/keyboard/cap11xx.c:475:1-6: WARNING: end returns can be simplified
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/input/keyboard/cap11xx.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 378db10001df..7240316ddfe3 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -472,12 +472,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
return -ENXIO;
}
- error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
- IRQF_ONESHOT, dev_name(dev), priv);
- if (error)
- return error;
-
- return 0;
+ return devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
+ IRQF_ONESHOT, dev_name(dev), priv);
}
static const struct of_device_id cap11xx_dt_ids[] = {
--
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]
| From | Daniel Mack <daniel@zonque.org> |
|---|---|
| Date | 2015-10-02 15:50 +0200 |
| Message-ID | <qf8SJ-4YE-13@gated-at.bofh.it> |
| In reply to | #1238247 |
On 10/02/2015 03:40 PM, Javier Martinez Canillas wrote:
> 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 warning:
>
> drivers/input/keyboard/cap11xx.c:475:1-6: WARNING: end returns can be simplified
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Daniel Mack <daniel@zonque.org>
> ---
>
> drivers/input/keyboard/cap11xx.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> index 378db10001df..7240316ddfe3 100644
> --- a/drivers/input/keyboard/cap11xx.c
> +++ b/drivers/input/keyboard/cap11xx.c
> @@ -472,12 +472,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,
> return -ENXIO;
> }
>
> - error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
> - IRQF_ONESHOT, dev_name(dev), priv);
> - if (error)
> - return error;
> -
> - return 0;
> + return devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func,
> + IRQF_ONESHOT, dev_name(dev), priv);
> }
>
> static const struct of_device_id cap11xx_dt_ids[] = {
>
--
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]
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Date | 2015-10-02 20:10 +0200 |
| Message-ID | <qfcWn-2zG-23@gated-at.bofh.it> |
| In reply to | #1238247 |
On Fri, Oct 02, 2015 at 03:40:18PM +0200, Javier Martinez Canillas wrote: > 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 warning: > > drivers/input/keyboard/cap11xx.c:475:1-6: WARNING: end returns can be simplified > > Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> > --- > > drivers/input/keyboard/cap11xx.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c > index 378db10001df..7240316ddfe3 100644 > --- a/drivers/input/keyboard/cap11xx.c > +++ b/drivers/input/keyboard/cap11xx.c > @@ -472,12 +472,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client, > return -ENXIO; > } > > - error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func, > - IRQF_ONESHOT, dev_name(dev), priv); > - if (error) > - return error; > - > - return 0; > + return devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func, > + IRQF_ONESHOT, dev_name(dev), priv); > } For cases where we have multiple of potentially failing actions: error = action1(); if (error) return error; error = action2(); if (error) return error; error = action3(); if (error) return error; return 0; I prefer not to compress the last action check to "return action3()". 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]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2015-10-02 20:20 +0200 |
| Message-ID | <qfd62-2L2-19@gated-at.bofh.it> |
| In reply to | #1238495 |
Hello Dmitry, On 10/02/2015 08:09 PM, Dmitry Torokhov wrote: [snip] >> >> - error = devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func, >> - IRQF_ONESHOT, dev_name(dev), priv); >> - if (error) >> - return error; >> - >> - return 0; >> + return devm_request_threaded_irq(dev, irq, NULL, cap11xx_thread_func, >> + IRQF_ONESHOT, dev_name(dev), priv); >> } > > For cases where we have multiple of potentially failing actions: > > error = action1(); > if (error) > return error; > > error = action2(); > if (error) > return error; > > error = action3(); > if (error) > return error; > > return 0; > > I prefer not to compress the last action check to "return action3()". > Fair enough, I don't mind if you drop those patches then. Thanks a lot for your feedback. > 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