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: <20171021184900.7e3e42d0@archlinux>
Date:   Sat, 21 Oct 2017 18:49:00 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Corentin Labbe <clabbe.montjoie@...il.com>
Cc:     knaack.h@....de, lars@...afoo.de, maxime.ripard@...e-electrons.com,
        wens@...e.org, pmeerw@...erw.net,
        quentin.schulz@...e-electrons.com, linux-iio@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: sun4i-gpadc: use of_device_get_match_data

On Fri, 20 Oct 2017 07:37:29 +0200
Corentin Labbe <clabbe.montjoie@...il.com> wrote:

> The usage of of_device_get_match_data reduce the code size a bit.
> Furthermore, it prevents an improbable dereference when
> of_match_device() return NULL.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@...il.com>
Nice little tidy up - thanks.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/sun4i-gpadc-iio.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
> index c4e70f1cad79..04d7147e0110 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -501,17 +501,15 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
>  				struct iio_dev *indio_dev)
>  {
>  	struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
> -	const struct of_device_id *of_dev;
>  	struct resource *mem;
>  	void __iomem *base;
>  	int ret;
>  
> -	of_dev = of_match_device(sun4i_gpadc_of_id, &pdev->dev);
> -	if (!of_dev)
> +	info->data = of_device_get_match_data(&pdev->dev);
> +	if (!info->data)
>  		return -ENODEV;
>  
>  	info->no_irq = true;
> -	info->data = (struct gpadc_data *)of_dev->data;
>  	indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels);
>  	indio_dev->channels = sun8i_a33_gpadc_channels;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ