On Sat, May 18, 2019 at 01:36:06AM +0200, Michael Grzeschik wrote:
> +static int pcf857x_probe(struct device_d *dev)
> +{
> +     struct i2c_client *client = to_i2c_client(dev);
> +     struct pcf857x_platform_data    *pdata = dev->platform_data;
> +     struct device_node              *np = dev->device_node;
> +     struct pcf857x                  *gpio;
> +     unsigned long                   driver_data;
> +     unsigned int                    n_latch = 0;
> +     int                             ret;
> +
> +     if (IS_ENABLED(CONFIG_OF) && np)
> +             of_property_read_u32(np, "lines-initial-states", &n_latch);
> +     else if (pdata)
> +             n_latch = pdata->n_latch;
> +
> +     /* Allocate, initialize, and register this gpio_chip. */
> +     gpio = xzalloc(sizeof(*gpio));
> +     if (!gpio)
> +             return -ENOMEM;

xzalloc never returns NULL.

> +     ret = gpiochip_add(&gpio->chip);
> +     if (ret)
> +             return ret;
> +
> +     /* Let platform code set up the GPIOs and their users.
> +      * Now is the first time anyone could use them.
> +      */
> +     if (pdata && pdata->setup) {
> +             ret = pdata->setup(client,
> +                             gpio->chip.base, gpio->chip.ngpio,
> +                             pdata->context);
> +             if (ret < 0)
> +                     dev_warn(&client->dev, "setup failed, %d\n", ret);
> +     }

I don't think we want to have that pdata->setup() support.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to