lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 21 May 2012 08:41:07 +0200
From:	Sascha Hauer <s.hauer@...gutronix.de>
To:	Shuah Khan <shuahkhan@...il.com>
Cc:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>,
	Bryan Wu <bryan.wu@...onical.com>,
	Richard Purdie <rpurdie@...ys.net>, kernel@...gutronix.de,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: leds: Add MAX6956 driver

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@...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

Powered by Openwall GNU/*/Linux Powered by OpenVZ