[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151004105056.GM4284@localhost>
Date: Sun, 4 Oct 2015 06:50:56 -0400
From: Johan Hovold <johan@...nel.org>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: Johan Hovold <johan@...nel.org>, Michal Marek <mmarek@...e.com>,
Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
linux-kernel@...r.kernel.org, cocci@...teme.lip6.fr
Subject: Re: [PATCH] coccinelle: misc: remove "complex return code" warnings
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists