All of lore.kernel.org
 help / color / mirror / Atom feed
From: johan@kernel.org (Johan Hovold)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] coccinelle: misc: remove "complex return code" warnings
Date: Sun, 4 Oct 2015 06:50:56 -0400	[thread overview]
Message-ID: <20151004105056.GM4284@localhost> (raw)
In-Reply-To: <alpine.DEB.2.02.1510022328560.2163@localhost6.localdomain6>

On Fri, Oct 02, 2015 at 11:33:46PM +0200, Julia Lawall wrote:
> Do you consider that this function would be better off in two lines?
> 
> static int mxt_acquire_irq(struct mxt_data *data)
> {
>         int error;
> 
>         enable_irq(data->irq);
> 
>         error = mxt_process_messages_until_invalid(data);
>         if (error)
>                 return error;
> 
>         return 0;
> }

Actually no, but again I'd say it's up to the author to decide.

> Would simplifying the code at the end of the following function be helpful
> or not?
> 
> static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
> {
>         struct gpio_chip *chip = &adnp->gpio;
>         int err;
> 
>         adnp->reg_shift = get_count_order(num_gpios) - 3;
> 
>         chip->direction_input = adnp_gpio_direction_input;
>         chip->direction_output = adnp_gpio_direction_output;
>         chip->get = adnp_gpio_get;
>         chip->set = adnp_gpio_set;
>         chip->can_sleep = true;
> 
>         if (IS_ENABLED(CONFIG_DEBUG_FS))
>                 chip->dbg_show = adnp_gpio_dbg_show;
> 
>         chip->base = -1;
>         chip->ngpio = num_gpios;
>         chip->label = adnp->client->name;
>         chip->dev = &adnp->client->dev;
>         chip->of_node = chip->dev->of_node;
>         chip->owner = THIS_MODULE;
> 
>         err = gpiochip_add(chip);
>         if (err)
>                 return err;
> 
>         return 0;
> }

I think this is just fine as is as well.

Thanks,
Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Johan Hovold <johan@kernel.org>, Michal Marek <mmarek@suse.com>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr
Subject: Re: [PATCH] coccinelle: misc: remove "complex return code" warnings
Date: Sun, 4 Oct 2015 06:50:56 -0400	[thread overview]
Message-ID: <20151004105056.GM4284@localhost> (raw)
In-Reply-To: <alpine.DEB.2.02.1510022328560.2163@localhost6.localdomain6>

On Fri, Oct 02, 2015 at 11:33:46PM +0200, Julia Lawall wrote:
> Do you consider that this function would be better off in two lines?
> 
> static int mxt_acquire_irq(struct mxt_data *data)
> {
>         int error;
> 
>         enable_irq(data->irq);
> 
>         error = mxt_process_messages_until_invalid(data);
>         if (error)
>                 return error;
> 
>         return 0;
> }

Actually no, but again I'd say it's up to the author to decide.

> Would simplifying the code at the end of the following function be helpful
> or not?
> 
> static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
> {
>         struct gpio_chip *chip = &adnp->gpio;
>         int err;
> 
>         adnp->reg_shift = get_count_order(num_gpios) - 3;
> 
>         chip->direction_input = adnp_gpio_direction_input;
>         chip->direction_output = adnp_gpio_direction_output;
>         chip->get = adnp_gpio_get;
>         chip->set = adnp_gpio_set;
>         chip->can_sleep = true;
> 
>         if (IS_ENABLED(CONFIG_DEBUG_FS))
>                 chip->dbg_show = adnp_gpio_dbg_show;
> 
>         chip->base = -1;
>         chip->ngpio = num_gpios;
>         chip->label = adnp->client->name;
>         chip->dev = &adnp->client->dev;
>         chip->of_node = chip->dev->of_node;
>         chip->owner = THIS_MODULE;
> 
>         err = gpiochip_add(chip);
>         if (err)
>                 return err;
> 
>         return 0;
> }

I think this is just fine as is as well.

Thanks,
Johan

  reply	other threads:[~2015-10-04 10:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 22:37 [Cocci] [PATCH] coccinelle: misc: remove "complex return code" warnings Johan Hovold
2015-09-30 22:37 ` Johan Hovold
2015-10-01  5:20 ` [Cocci] " Julia Lawall
2015-10-01  5:20   ` Julia Lawall
2015-10-01 17:47   ` [Cocci] " Johan Hovold
2015-10-01 17:47     ` Johan Hovold
2015-10-02 21:33     ` [Cocci] " Julia Lawall
2015-10-02 21:33       ` Julia Lawall
2015-10-04 10:50       ` Johan Hovold [this message]
2015-10-04 10:50         ` Johan Hovold
2015-10-03 16:24     ` [Cocci] " Julia Lawall
2015-10-03 16:24       ` Julia Lawall
2015-10-04 10:52       ` [Cocci] " Johan Hovold
2015-10-04 10:52         ` Johan Hovold
2015-10-03 16:25 ` [Cocci] " Julia Lawall
2015-10-03 16:25   ` Julia Lawall
2015-10-28  9:54   ` Johan Hovold
2015-10-28 10:04     ` [Cocci] " Michal Marek
2015-10-28 10:04       ` Michal Marek
2015-10-28 10:09       ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151004105056.GM4284@localhost \
    --to=johan@kernel.org \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.