mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tiantao (H)" <tiantao6@huawei.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	Tian Tao <tiantao6@hisilicon.com>, <airlied@linux.ie>,
	<daniel@ffwll.ch>, <kraxel@redhat.com>,
	<alexander.deucher@amd.com>, <tglx@linutronix.de>,
	<dri-devel@lists.freedesktop.org>, <xinliang.liu@linaro.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/hisilicon: Remove redundant null check
Date: Mon, 2 Nov 2020 17:06:43 +0800	[thread overview]
Message-ID: <48f68940-14a4-6ea7-4296-53970cd74015@huawei.com> (raw)
In-Reply-To: <b3656895-42a5-ff20-a695-dccaf1992938@suse.de>



在 2020/11/2 17:03, Thomas Zimmermann 写道:
> Hi
> 
> Am 02.11.20 um 09:46 schrieb tiantao (H):
>>
>>
>> 在 2020/11/2 16:32, Thomas Zimmermann 写道:
>>> Hi
>>>
>>> Am 30.10.20 um 10:27 schrieb Tian Tao:
>>>> drm_irq_uninstall can handle the case where dev->irq_enable is false,
>>>> so Remove redundant null check.
>>>>
>>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>>> ---
>>>>    drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
>>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> index 0c1b40d..b71589b1 100644
>>>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> @@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
>>>>          drm_atomic_helper_shutdown(dev);
>>>>    -    if (dev->irq_enabled)
>>>> -        drm_irq_uninstall(dev);
>>>> -
>>>> +    drm_irq_uninstall(dev);
>>>
>>> Removing this check would at least result in an error, [1] so rather
>>> leave it in for now.
>>>
>> Now there seems to be no driver to check the return value of
>> drm_irq_uninstall
> 
> True. No clean-up code should ever fail. But currently, it's not handled
> by drm_irq_uninstall().
> 
> A better fix would be to have drm_irq_uninstall() return early with a
> warning if IRQs are disabled. And for most drivers, a managed version of
> drm_irq_install() would be useful.
> 
Codes like the following
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 09d6e9e..572357c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
         bool irq_enabled;
         int i;

+       if(!dev->irq_enabled || !dev)
+               return 0;
> Best regards
> Thomas
> 
>>> Instead, we could discuss if drm_irq_install() should become a managed
>>> interface.
>>
>> Codes like the following
>> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
>> index 09d6e9e..572357c 100644
>> --- a/drivers/gpu/drm/drm_irq.c
>> +++ b/drivers/gpu/drm/drm_irq.c
>> @@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
>>          bool irq_enabled;
>>          int i;
>>
>> +       if(!dev->irq_enabled || !dev)
>> +               return 0;
>>
>>>
>>> Best regards
>>> Thomas
>>>
>>> [1]
>>> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L201
>>>
>>>
>>>>        pci_disable_msi(dev->pdev);
>>>> +
>>>>        hibmc_kms_fini(priv);
>>>>        hibmc_mm_fini(priv);
>>>>        dev->dev_private = NULL;
>>>> +
>>>>        return 0;
>>>>    }
>>>>   
>>>
>>
> 


      reply	other threads:[~2020-11-02  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  9:27 Tian Tao
2020-11-02  8:32 ` Thomas Zimmermann
2020-11-02  8:46   ` tiantao (H)
2020-11-02  9:03     ` Thomas Zimmermann
2020-11-02  9:06       ` tiantao (H) [this message]

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=48f68940-14a4-6ea7-4296-53970cd74015@huawei.com \
    --to=tiantao6@huawei.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tiantao6@hisilicon.com \
    --cc=tzimmermann@suse.de \
    --cc=xinliang.liu@linaro.org \
    /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

all inboxes | Powered by JetHome®