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]
Message-ID: <d6994f56-57dc-4a66-ad7d-1daa04788b22@collabora.com>
Date: Wed, 3 Jul 2024 14:43:47 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: NĂ­colas F. R. A. Prado <nfraprado@...labora.com>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Matthias Brugger <matthias.bgg@...il.com>, kernel@...labora.com,
 linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] cpufreq: mediatek: Use dev_err_probe in every error path
 in probe

Il 02/07/24 10:43, Viresh Kumar ha scritto:
> On 02-07-24, 10:26, AngeloGioacchino Del Regno wrote:
>> Il 02/07/24 07:57, Viresh Kumar ha scritto:
>>> On 28-06-24, 15:48, NĂ­colas F. R. A. Prado wrote:
>>>> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
>>>> @@ -629,11 +630,9 @@ static int mtk_cpufreq_probe(struct platform_device *pdev)
>>>>    	int cpu, ret;
>>>>    	data = dev_get_platdata(&pdev->dev);
>>>> -	if (!data) {
>>>> -		dev_err(&pdev->dev,
>>>> -			"failed to get mtk cpufreq platform data\n");
>>>> -		return -ENODEV;
>>>> -	}
>>>> +	if (!data)
>>>> +		return dev_err_probe(&pdev->dev, -ENODEV,
>>>
>>> What's the point of calling dev_err_probe() when we know for sure that
>>> the error isn't EPROBE_DEFER ?
>>>
>>
>> Logging consistency, that's all; the alternative would be to rewrite the dev_err()
>> messages to be consistent with what dev_err_probe() says, so that'd be
>> dev_err("error %pe: (message)");
> 
> That would be better I guess. There is no point adding inefficient
> code.
> 
>>>> +				     "failed to get mtk cpufreq platform data\n");
>>>>    	for_each_possible_cpu(cpu) {
>>>>    		info = mtk_cpu_dvfs_info_lookup(cpu);
>>>> @@ -643,24 +642,21 @@ static int mtk_cpufreq_probe(struct platform_device *pdev)
>>>>    		info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
>>>>    		if (!info) {
>>>>    			ret = -ENOMEM;
>>>> +			dev_err_probe(&pdev->dev, ret, "Failed to allocate dvfs_info\n");
>>>
>>
>> By the way, forgot to point that out in my former review: to make it shorter,
>> instead of "ret = -ENOMEM; dev_err_probe()" you can write it as...
>>
>> ret = dev_err_probe(&pdev->dev, -ENOMEM, ".... message");
> 
> `ret` will be  be used I guess with the `goto` statement to return
> error and so the change was like this.
> 

Yes it will, but `ret = dev_err_probe(dev, -ENOMEM, "...")` is still kind of a
shortcut, as that will effectively assign -ENOMEM to ret, so that the error is
still returned like before ;-)

Cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ