public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 25/79] staging: media: vde: use pm_runtime_resume_and_get()
Date: Wed, 28 Apr 2021 11:05:04 +0300	[thread overview]
Message-ID: <433bd38c-aec9-a17e-35ca-8a6fca5fa5ef@gmail.com> (raw)
In-Reply-To: <20210428092043.380c9d4c@coco.lan>

28.04.2021 10:20, Mauro Carvalho Chehab пишет:
> Em Tue, 27 Apr 2021 14:47:01 +0300
> Dmitry Osipenko <digetx@gmail.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.


  reply	other threads:[~2021-04-28  8:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 10:25 [PATCH v3 00/79] Address some issues with PM runtime at media subsystem Mauro Carvalho Chehab
2021-04-27 10:26 ` [PATCH v3 25/79] staging: media: vde: use pm_runtime_resume_and_get() Mauro Carvalho Chehab
2021-04-27 11:47   ` Dmitry Osipenko
2021-04-28  7:20     ` Mauro Carvalho Chehab
2021-04-28  8:05       ` Dmitry Osipenko [this message]
2021-04-27 10:26 ` [PATCH v3 26/79] staging: media: csi: " Mauro Carvalho Chehab
2021-04-27 10:26 ` [PATCH v3 27/79] staging: media: vi: " Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=433bd38c-aec9-a17e-35ca-8a6fca5fa5ef@gmail.com \
    --to=digetx@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox