[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1389078870.32137.5.camel@joe-AO722>
Date: Mon, 06 Jan 2014 23:14:30 -0800
From: Joe Perches <joe@...ches.com>
To: Xiubo Li <Li.Xiubo@...escale.com>
Cc: thierry.reding@...il.com, linux-pwm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pwm: core: Use devm_kzalloc instead of kzalloc
On Tue, 2014-01-07 at 14:05 +0800, Xiubo Li wrote:
> Use devm_kzalloc instead of kzalloc to free automatically and make
> the cleanup paths simpler and the code slightly shorter.
[]
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
[]
> @@ -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);
There is a devm_kcalloc and this should likely use it.
--
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