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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220315171852.3b2f1dc4@endymion.delvare>
Date:   Tue, 15 Mar 2022 17:18:52 +0100
From:   Jean Delvare <jdelvare@...e.de>
To:     cgel.zte@...il.com
Cc:     linux@...ck-us.net, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] hwmon: (scpi-hwmon): Use of_device_get_match_data()

On Tue, 15 Mar 2022 02:34:12 +0000, cgel.zte@...il.com wrote:
> From: Minghao Chi <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 <chi.minghao@....com.cn>
> ---
>  drivers/hwmon/scpi-hwmon.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 919877970ae3..5187c6dd5a4f 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -141,7 +141,6 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>  	struct scpi_ops *scpi_ops;
>  	struct device *hwdev, *dev = &pdev->dev;
>  	struct scpi_sensors *scpi_sensors;
> -	const struct of_device_id *of_id;
>  	int idx, ret;
>  
>  	scpi_ops = get_scpi_ops();
> @@ -171,12 +170,11 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>  
>  	scpi_sensors->scpi_ops = scpi_ops;
>  
> -	of_id = of_match_device(scpi_of_match, &pdev->dev);
> -	if (!of_id) {
> +	scale = of_device_get_match_data(&pdev->dev);
> +	if (!scale) {
>  		dev_err(&pdev->dev, "Unable to initialize scpi-hwmon data\n");
>  		return -ENODEV;
>  	}
> -	scale = of_id->data;
>  
>  	for (i = 0, idx = 0; i < nr_sensors; i++) {
>  		struct sensor_data *sensor = &scpi_sensors->data[idx];

Reviewed-by: Jean Delvare <jdelvare@...e.de>

-- 
Jean Delvare
SUSE L3 Support

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ