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: <a102d4e0-f142-4c4f-4d9d-812075c0214f@cmss.chinamobile.com>
Date:   Tue, 28 Sep 2021 09:21:06 +0800
From:   tangbin <tangbin@...s.chinamobile.com>
To:     Sebastian Reichel <sebastian.reichel@...labora.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Tony Lindgren <tony@...mide.com>
Subject: Re: [PATCH] power: supply: cpcap-battery: remove redundant check

Hi, Reichel

On 2021/9/27 23:46, Sebastian Reichel wrote:
> NAK. Instead replace the complate of_match_device() part. The driver
> only needs the data object and there is of_device_get_match_data()
> for this. Also - even better - there is a non-DT specific variant
> which is device_get_match_data(). Please use that:
>
>
> const struct cpcap_battery_config *cfg = device_get_match_data(&pdev->dev);
> if (!cfg)
>      return -ENODEV;
>
> memcpy(&ddata->config, cfg, sizeof(ddata->config));
>
Got it. Before this patch, I thought it would be better to use 
of_device_get_match_data()

to simplify for this place, but your email made me learn it again. I 
will send patch v2 for

you.

Thanks

Tang Bin

>
>>   drivers/power/supply/cpcap-battery.c | 6 ------
>>   1 file changed, 6 deletions(-)
>>
>> diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
>> index 8d62d4241..a3866826b 100644
>> --- a/drivers/power/supply/cpcap-battery.c
>> +++ b/drivers/power/supply/cpcap-battery.c
>> @@ -1035,12 +1035,6 @@ static int cpcap_battery_probe(struct platform_device *pdev)
>>   	if (!match)
>>   		return -EINVAL;
>>   
>> -	if (!match->data) {
>> -		dev_err(&pdev->dev, "no configuration data found\n");
>> -
>> -		return -ENODEV;
>> -	}
>> -
>>   	ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
>>   	if (!ddata)
>>   		return -ENOMEM;
>> -- 
>> 2.20.1.windows.1
>>
>>
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ