Re: [PATCH] ARM: leds: Add MAX6956 driver

From: Sascha Hauer
Date: Mon May 21 2012 - 02:41:19 EST


On Fri, May 18, 2012 at 01:37:11PM -0600, Shuah Khan wrote:
> On Fri, 2012-05-18 at 17:45 +0200, Uwe Kleine-König wrote:
> > This adds a driver for Maxim's MAX6956 28-Port LED Display Driver and
> > I/O Expander.
>
> > +static void max6956_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> > +{
> > + struct max6956_ddata *ddata = ddata_from_gpio_chip(chip);
> > +
> > + regmap_write(ddata->regmap, MAX6956_REG_PORT(offset), !!value);
> > +}
> > +
> > +static const struct gpio_chip max6956_gpio_chip_init __devinitconst = {
> > + .label = "max6956",
> > + .owner = THIS_MODULE,
> > + .request = max6956_gpio_request,
> > + .direction_input = max6956_gpio_direction_input,
> > + .get = max6956_gpio_get,
> > + .direction_output = max6956_gpio_direction_output,
> > + .set = max6956_gpio_set,
> > + .base = -1,
> > + .ngpio = 32,
> > + .can_sleep = 1,
> > +};
> > +
> > +static int __devinit max6956_probe(struct i2c_client *client,
> > + const struct i2c_device_id *id)
> > +{
> > + struct max6956_ddata *ddata;
> > + struct max6956_pdata *pdata = client->dev.platform_data;
> > + int ret, i;
> > +
> > + if (!pdata)
> > + return -EINVAL;
> > +
> > + ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL);
>
> I don't see this memory getting free'ed in error legs and also from
> max6956_remove().

/**
* devm_kzalloc - Resource-managed kzalloc
* @dev: Device to allocate memory for
* @size: Allocation size
* @gfp: Allocation gfp flags
*
* Managed kzalloc. Memory allocated with this function is
* automatically freed on driver detach. Like all other devres
* resources, guaranteed alignment is unsigned long long.
*
* RETURNS:
* Pointer to allocated memory on success, NULL on failure.
*/

The same applies to all other devm_* functions.

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