lkml.org 
[lkml]   [2012]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 6/6] mfd: mc13xxx: Add i2c driver
From
Hi Marc,

On Thu, Mar 15, 2012 at 2:13 AM, Marc Reilly <marc@cpdesign.com.au> wrote:
> Adds support for mc13xxx family ICs connected via i2c.
>
> Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
> ---
<snip>

> +static int mc13xxx_i2c_probe(struct i2c_client *client,
> +               const struct i2c_device_id *id)
> +{
> +       const struct of_device_id *of_id;
> +       struct i2c_driver *idrv = to_i2c_driver(client->dev.driver);
> +       struct mc13xxx *mc13xxx;
> +       struct mc13xxx_platform_data *pdata = dev_get_platdata(&client->dev);
> +       int ret;
> +
> +       of_id = of_match_device(mc13xxx_dt_ids, &client->dev);
> +       if (of_id)
> +               idrv->id_table =
> +                       &mc13xxx_i2c_device_id[(enum mc13xxx_id) of_id->data];
> +
> +       mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
> +       if (!mc13xxx)
> +               return -ENOMEM;
> +
> +       dev_set_drvdata(&client->dev, mc13xxx);
> +
> +       mc13xxx->dev = &client->dev;
> +       mutex_init(&mc13xxx->lock);
> +
> +       mc13xxx->regmap = regmap_init_i2c(client, &mc13xxx_regmap_i2c_config);
> +       if (IS_ERR(mc13xxx->regmap)) {
> +               ret = PTR_ERR(mc13xxx->regmap);
> +               dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
> +                               ret);
> +               dev_set_drvdata(&client->dev, NULL);
Are we leaking mc13xxx here
May be you can consider using devm* functions ?

> +               return ret;
> +       }
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-15 14:43    [W:0.069 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site