lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Aug 2015 11:38:47 +0300
From:	Grygorii Strashko <grygorii.strashko@...com>
To:	Peng Fan <van.freenix@...il.com>, <linus.walleij@...aro.org>,
	<gnurou@...il.com>
CC:	<linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code

On 08/24/2015 03:05 PM, Peng Fan wrote:
> Use devm_* API to simplify driver code.
>
> Signed-off-by: Peng Fan <van.freenix@...il.com>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Cc: Alexandre Courbot <gnurou@...il.com>
  ---
>   drivers/gpio/gpiolib.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 6bc612b..f9470b0 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -243,7 +243,8 @@ int gpiochip_add(struct gpio_chip *chip)
>   	int		base = chip->base;
>   	struct gpio_desc *descs;
>
> -	descs = kcalloc(chip->ngpio, sizeof(descs[0]), GFP_KERNEL);
> +	descs = devm_kcalloc(chip->dev, chip->ngpio, sizeof(descs[0]),
> +			     GFP_KERNEL);

^ above will not work for every one as NOT all GPIO drivers
implemented using dev/drv model, so chip->dev could be not set
(at least it was true when I've checked it last time).




-- 
regards,
-grygorii
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ