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] [day] [month] [year] [list]
Message-Id: <201205250819.33101.marek.vasut@gmail.com>
Date:	Fri, 25 May 2012 08:19:32 +0200
From:	Marek Vasut <marek.vasut@...il.com>
To:	Jingoo Han <jg1.han@...sung.com>
Cc:	"'Andrew Morton'" <akpm@...ux-foundation.org>,
	"'LKML'" <linux-kernel@...r.kernel.org>,
	"'Richard Purdie'" <rpurdie@...ys.net>
Subject: Re: [PATCH 08/13] backlight: lms283gf05: use devm_ functions

Dear Jingoo Han,

> The devm_ functions allocate memory that is released when a driver
> detaches. This patch uses devm_kzalloc of these functions.
> 
> Cc: Marek Vasut <marex@...x.de>
> Cc: Richard Purdie <rpurdie@...ys.net>
> Signed-off-by: Jingoo Han <jg1.han@...sung.com>

Acked-by: Marek Vasut <marek.vasut@...il.com>

> ---
>  drivers/video/backlight/lms283gf05.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/backlight/lms283gf05.c
> b/drivers/video/backlight/lms283gf05.c index 4161f9e..a9f2c36 100644
> --- a/drivers/video/backlight/lms283gf05.c
> +++ b/drivers/video/backlight/lms283gf05.c
> @@ -168,7 +168,8 @@ static int __devinit lms283gf05_probe(struct spi_device
> *spi) goto err;
>  	}
> 
> -	st = kzalloc(sizeof(struct lms283gf05_state), GFP_KERNEL);
> +	st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
> +				GFP_KERNEL);
>  	if (st == NULL) {
>  		dev_err(&spi->dev, "No memory for device state\n");
>  		ret = -ENOMEM;
> @@ -178,7 +179,7 @@ static int __devinit lms283gf05_probe(struct spi_device
> *spi) ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); if
> (IS_ERR(ld)) {
>  		ret = PTR_ERR(ld);
> -		goto err2;
> +		goto err;
>  	}
> 
>  	st->spi = spi;
> @@ -193,8 +194,6 @@ static int __devinit lms283gf05_probe(struct spi_device
> *spi)
> 
>  	return 0;
> 
> -err2:
> -	kfree(st);
>  err:
>  	if (pdata != NULL)
>  		gpio_free(pdata->reset_gpio);
> @@ -212,8 +211,6 @@ static int __devexit lms283gf05_remove(struct
> spi_device *spi) if (pdata != NULL)
>  		gpio_free(pdata->reset_gpio);
> 
> -	kfree(st);
> -
>  	return 0;
>  }

Best regards,
Marek Vasut
--
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