public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Shuah Khan <shuahkhan@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Bryan Wu" <bryan.wu@canonical.com>,
	"Richard Purdie" <rpurdie@rpsys.net>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: leds: Add MAX6956 driver
Date: Mon, 21 May 2012 08:41:07 +0200	[thread overview]
Message-ID: <20120521064107.GV30400@pengutronix.de> (raw)
In-Reply-To: <1337369831.2426.15.camel@lorien2>

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 |

  reply	other threads:[~2012-05-21  6:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 15:45 [PATCH] ARM: leds: Add MAX6956 driver Uwe Kleine-König
2012-05-18 19:37 ` Shuah Khan
2012-05-21  6:41   ` Sascha Hauer [this message]
2012-05-21  4:50 ` Bryan Wu
2012-05-21  8:26   ` Uwe Kleine-König
2012-05-21  9:41     ` [PATCH v2] " Uwe Kleine-König
2012-05-21 19:33       ` [PATCH v3] " Uwe Kleine-König
2012-05-21 21:30         ` Linus Walleij
2012-05-24 16:17           ` Uwe Kleine-König
2012-05-25  6:55             ` Linus Walleij
2012-06-22  6:06         ` Uwe Kleine-König
2012-05-21 16:12     ` [PATCH] ARM: " Shuah Khan

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=20120521064107.GV30400@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=bryan.wu@canonical.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=shuahkhan@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox