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:   Wed, 8 Nov 2017 16:31:53 +0100
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Andi Shyti <andi@...zian.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     Michael Hennerich <michael.hennerich@...log.com>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andi Shyti <andi.shyti@...sung.com>
Subject: Re: [PATCH v2 1/3] Input: ad7897 - use managed allocated resources

On 11/08/2017 03:04 PM, Andi Shyti wrote:
> Use managed allocated resources to simplify error handling during
> probing failure and module exiting.
> 
> With this all the goto labels in the probe function together with
> the cleanups in the remove function are unnecessary, therefore
> removed.
> 
> CC: Michael Hennerich <michael.hennerich@...log.com>
> Signed-off-by: Andi Shyti <andi@...zian.org>
> ---
>  drivers/input/touchscreen/ad7877.c | 42 +++++++++-----------------------------
>  1 file changed, 10 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
> index 0381c7809d1b..c8a143db8681 100644
> --- a/drivers/input/touchscreen/ad7877.c
> +++ b/drivers/input/touchscreen/ad7877.c
> @@ -707,12 +707,10 @@ static int ad7877_probe(struct spi_device *spi)
>  		return err;
>  	}
>  
> -	ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL);
> -	input_dev = input_allocate_device();
> -	if (!ts || !input_dev) {
> -		err = -ENOMEM;
> -		goto err_free_mem;
> -	}
> +	ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL);
> +	input_dev = devm_input_allocate_device(&spi->dev);
> +	if (!input_dev)

You removed the check for 'ts' here and only added it back in patch 3.

> +		return -ENOMEM;
>  
>  	spi_set_drvdata(spi, ts);
>  	ts->spi = spi;
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ