[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55108E2B.7050305@linaro.org>
Date: Mon, 23 Mar 2015 22:05:31 +0000
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: Mark Brown <broonie@...nel.org>
CC: linux-arm-kernel@...ts.infradead.org,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Kumar Gala <galak@...eaurora.org>, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
Stephen Boyd <sboyd@...eaurora.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v2 1/7] eeprom: Add a simple EEPROM framework for eeprom
providers
On 23/03/15 21:09, Mark Brown wrote:
> On Fri, Mar 13, 2015 at 09:50:14AM +0000, Srinivas Kandagatla wrote:
>
> A couple of *very* minor points below, otherwise this looks OK to me.
>
Thankyou for the review.
>> +struct eeprom_device *eeprom_register(struct eeprom_config *config)
>> +{
>> + struct eeprom_device *eeprom;
>> + int rval;
>> +
>> + if (!config->regmap || !config->size) {
>> + dev_err(config->dev, "Regmap not found\n");
>> + return ERR_PTR(-EINVAL);
>> + }
>
> You have a struct device in the config and the regmap API has
> dev_get_regmap() which for most devices that don't have multiple regmaps
> will give the right regmap. It would be nice to support this as a
> convenience for users.
Yes, sure that makes sense, I will give it a try.
>
>> + eeprom = kzalloc(sizeof(*eeprom), GFP_KERNEL);
>> + if (!eeprom)
>> + return ERR_PTR(-ENOMEM);
>
> ...
>
>> + rval = device_add(&eeprom->dev);
>> + if (rval)
>> + return ERR_PTR(rval);
>
> Don't you need a kfree() if device_add() fails?
I will fix it in next version.
--srini
>
--
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