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: <433bd38c-aec9-a17e-35ca-8a6fca5fa5ef@gmail.com>
Date:   Wed, 28 Apr 2021 11:05:04 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc:     linuxarm@...wei.com, mauro.chehab@...wei.com,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, linux-tegra@...r.kernel.org
Subject: Re: [PATCH v3 25/79] staging: media: vde: use
 pm_runtime_resume_and_get()

28.04.2021 10:20, Mauro Carvalho Chehab пишет:
> Em Tue, 27 Apr 2021 14:47:01 +0300
> Dmitry Osipenko <digetx@...il.com> escreveu:
> 
>> 27.04.2021 13:26, Mauro Carvalho Chehab пишет:
>>> @@ -1088,8 +1090,9 @@ static int tegra_vde_remove(struct platform_device *pdev)
>>>  {
>>>  	struct tegra_vde *vde = platform_get_drvdata(pdev);
>>>  	struct device *dev = &pdev->dev;
>>> +	int ret;
>>>  
>>> -	pm_runtime_get_sync(dev);
>>> +	ret = pm_runtime_resume_and_get(dev);  
>>
>> Should be cleaner to return error directly here, IMO.
> 
> I double-checked how drivers/base/platform.c deals with non-zero
> returns at the .remove method:
> 
> 	static int platform_remove(struct device *_dev)
> 	{
> 	        struct platform_driver *drv = to_platform_driver(_dev->driver);
> 	        struct platform_device *dev = to_platform_device(_dev);
> 	
> 	        if (drv->remove) {
> 	                int ret = drv->remove(dev);
> 	
> 	                if (ret)
> 	                        dev_warn(_dev, "remove callback returned a non-zero value. This will be ignored.\n");
> 	        }
> 	        dev_pm_domain_detach(_dev, true);
> 	
> 	        return 0;
> 	}
> 
> Basically, it will print a message but will ignore whatever happens
> afterwards.
> 
> So, if the driver is changed to return an error there, it will leak
> resources.

Indeed, thank you. But then the pm_runtime_get_sync() should be more
appropriate since this function is specifically made for such cases
where returned value is ignored.

A better option could be better to add a clarifying comment to the code
rather than to change it to a variant which introduces confusion, IMO.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ