All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jing Xiangfeng <jingxiangfeng@huawei.com>
To: <maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
	<tzimmermann@suse.de>, <airlied@linux.ie>, <ajax@redhat.com>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm: remove redundant assignment to variable 'ret'
Date: Thu, 16 Jul 2020 09:59:38 +0800	[thread overview]
Message-ID: <5F0FB48A.6080407@huawei.com> (raw)
In-Reply-To: <20200715120503.GJ3278063@phenom.ffwll.local>



On 2020/7/15 20:05, Daniel Vetter wrote:
> On Wed, Jul 15, 2020 at 03:05:59PM +0800, Jing Xiangfeng wrote:
>> The variable ret has been assigned the value '-EINVAL'. The assignment
>> in the if() is redundant. We can remove it.
>
> Nope, that's not correct. Before this assignement ret is guaranteed to be
> 0.

Before this assignment ret is '-EINVAL'(see commit 45bc3d26c95a: "drm: 
rework SET_MASTER and DROP_MASTER perm handling"). It is set to 0 above
around the drm_drop_master() calls.

Thanks
> -Daniel
>
>>
>> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
>> ---
>>   drivers/gpu/drm/drm_auth.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>> index 800ac39f3213..6e1b502f2797 100644
>> --- a/drivers/gpu/drm/drm_auth.c
>> +++ b/drivers/gpu/drm/drm_auth.c
>> @@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>
>>   	if (file_priv->master->lessor != NULL) {
>>   		DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
>> -		ret = -EINVAL;
>>   		goto out_unlock;
>>   	}
>>
>> --
>> 2.17.1
>>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Jing Xiangfeng <jingxiangfeng@huawei.com>
To: <maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
	<tzimmermann@suse.de>, <airlied@linux.ie>, <ajax@redhat.com>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm: remove redundant assignment to variable 'ret'
Date: Thu, 16 Jul 2020 09:59:38 +0800	[thread overview]
Message-ID: <5F0FB48A.6080407@huawei.com> (raw)
In-Reply-To: <20200715120503.GJ3278063@phenom.ffwll.local>



On 2020/7/15 20:05, Daniel Vetter wrote:
> On Wed, Jul 15, 2020 at 03:05:59PM +0800, Jing Xiangfeng wrote:
>> The variable ret has been assigned the value '-EINVAL'. The assignment
>> in the if() is redundant. We can remove it.
>
> Nope, that's not correct. Before this assignement ret is guaranteed to be
> 0.

Before this assignment ret is '-EINVAL'(see commit 45bc3d26c95a: "drm: 
rework SET_MASTER and DROP_MASTER perm handling"). It is set to 0 above
around the drm_drop_master() calls.

Thanks
> -Daniel
>
>>
>> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
>> ---
>>   drivers/gpu/drm/drm_auth.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>> index 800ac39f3213..6e1b502f2797 100644
>> --- a/drivers/gpu/drm/drm_auth.c
>> +++ b/drivers/gpu/drm/drm_auth.c
>> @@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>
>>   	if (file_priv->master->lessor != NULL) {
>>   		DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
>> -		ret = -EINVAL;
>>   		goto out_unlock;
>>   	}
>>
>> --
>> 2.17.1
>>
>

  reply	other threads:[~2020-07-16  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15  7:05 [PATCH] drm: remove redundant assignment to variable 'ret' Jing Xiangfeng
2020-07-15  7:05 ` Jing Xiangfeng
2020-07-15 12:05 ` Daniel Vetter
2020-07-15 12:05   ` Daniel Vetter
2020-07-16  1:59   ` Jing Xiangfeng [this message]
2020-07-16  1:59     ` Jing Xiangfeng
2020-07-16 10:02     ` Daniel Vetter
2020-07-16 10:02       ` Daniel Vetter

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=5F0FB48A.6080407@huawei.com \
    --to=jingxiangfeng@huawei.com \
    --cc=airlied@linux.ie \
    --cc=ajax@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.