[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1af212b11abb47b9bf97dea7329f1151@BY2PR03MB505.namprd03.prod.outlook.com>
Date: Wed, 8 Jan 2014 04:58:31 +0000
From: "Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
CC: "thierry.reding@...il.com" <thierry.reding@...il.com>,
"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] pwm: core: Use devm_kzalloc instead of kzalloc
> > drivers/pwm/core.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > index 2ca9504..74c9f9a 100644
> > --- a/drivers/pwm/core.c
> > +++ b/drivers/pwm/core.c
> > @@ -80,7 +80,6 @@ static void free_pwms(struct pwm_chip *chip)
> >
> > bitmap_clear(allocated_pwms, chip->base, chip->npwm);
> >
> > - kfree(chip->pwms);
> > chip->pwms = NULL;
> > }
> >
> > @@ -245,7 +244,9 @@ int pwmchip_add(struct pwm_chip *chip)
> > if (ret < 0)
> > goto out;
> >
> > - chip->pwms = kzalloc(chip->npwm * sizeof(*pwm), GFP_KERNEL);
> > + chip->pwms = devm_kzalloc(chip->dev,
> > + chip->npwm * sizeof(*pwm),
> > + GFP_KERNEL);
> > if (!chip->pwms) {
> > ret = -ENOMEM;
> > goto out;
>
> Is it guaranteed that pwmchip_add()/free_pwms() will only be called in
> probe() and remove() paths? It is probably safe assumption, but maybe it
> should be mentioned in comments now that we definitely have this
> restricion.
>
Yes, for now they are.
Thanks.
--
Best Regards,
Xiubo
--
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