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]
Date:   Tue, 22 Feb 2022 15:28:08 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     "cgel.zte@...il.com" <cgel.zte@...il.com>,
        "oss@...error.net" <oss@...error.net>
CC:     Zeal Robot <zealci@....com.cn>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Minghao Chi <chi.minghao@....com.cn>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH] platforms/83xx: Use of_device_get_match_data()

Resending as I accidentaly sent my response to the list only.

Le 21/02/2022 à 03:03, cgel.zte@...il.com a écrit :
> From: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@....com.cn>
> ---
>   arch/powerpc/platforms/83xx/suspend.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
> index bb147d34d4a6..9ae9268b683c 100644
> --- a/arch/powerpc/platforms/83xx/suspend.c
> +++ b/arch/powerpc/platforms/83xx/suspend.c
> @@ -322,17 +322,12 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
>   static const struct of_device_id pmc_match[];
>   static int pmc_probe(struct platform_device *ofdev)
>   {
> -	const struct of_device_id *match;
>   	struct device_node *np = ofdev->dev.of_node;
>   	struct resource res;
>   	const struct pmc_type *type;
>   	int ret = 0;
>   
> -	match = of_match_device(pmc_match, &ofdev->dev);
> -	if (!match)
> -		return -EINVAL;
> -
> -	type = match->data;
> +	type = of_device_get_match_data(&ofdev->dev);

What happens when of_device_get_match_data() returns NULL ?

>   
>   	if (!of_device_is_available(np))
>   		return -ENODEV;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ