* [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init()
@ 2021-05-08 3:48 Zhen Lei
2021-05-08 7:34 ` Pierre Moreau
0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2021-05-08 3:48 UTC (permalink / raw)
To: Ben Skeggs, David Airlie, Daniel Vetter, Pierre Moreau,
dri-devel, nouveau, linux-kernel
Cc: Zhen Lei
Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.
Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/gpu/drm/nouveau/nouveau_backlight.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index 72f35a2babcb..097ca344a086 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -273,6 +273,7 @@ nouveau_backlight_init(struct drm_connector *connector)
return -ENOMEM;
if (!nouveau_get_backlight_name(backlight_name, bl)) {
+ ret = -ENOSPC;
NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
goto fail_alloc;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init()
2021-05-08 3:48 [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init() Zhen Lei
@ 2021-05-08 7:34 ` Pierre Moreau
2021-05-08 9:18 ` Leizhen (ThunderTown)
0 siblings, 1 reply; 3+ messages in thread
From: Pierre Moreau @ 2021-05-08 7:34 UTC (permalink / raw)
To: Zhen Lei
Cc: Dan Carpenter, Ben Skeggs, David Airlie, Daniel Vetter,
dri-devel, nouveau, linux-kernel
Hello Zhen,
There was a similar patch sent in last month, though which does not seem to
have been merged yet; see
https://lists.freedesktop.org/archives/nouveau/2021-April/038451.html.
Whether `ret` should be `-ENOSPC` or `-ENOMEM` is hard to say as
`nouveau_get_backlight_name()` could fail due to either.
I will propose an alternative fix which modifies `nouveau_get_backlight_name()`
to return an int so the actual error code can be propagated back instead of
guessed, as well as fix an ida ID leak which I just spotted.
Best,
Pierre
On 2021-05-08 — 11:48, Zhen Lei wrote:
> Fix to return a negative error code from the error handling case instead
> of 0, as done elsewhere in this function.
>
> Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_backlight.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index 72f35a2babcb..097ca344a086 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -273,6 +273,7 @@ nouveau_backlight_init(struct drm_connector *connector)
> return -ENOMEM;
>
> if (!nouveau_get_backlight_name(backlight_name, bl)) {
> + ret = -ENOSPC;
> NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
> goto fail_alloc;
> }
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init()
2021-05-08 7:34 ` Pierre Moreau
@ 2021-05-08 9:18 ` Leizhen (ThunderTown)
0 siblings, 0 replies; 3+ messages in thread
From: Leizhen (ThunderTown) @ 2021-05-08 9:18 UTC (permalink / raw)
To: Dan Carpenter, Ben Skeggs, David Airlie, Daniel Vetter,
dri-devel, nouveau, linux-kernel
On 2021/5/8 15:34, Pierre Moreau wrote:
> Hello Zhen,
>
> There was a similar patch sent in last month, though which does not seem to
> have been merged yet; see
> https://lists.freedesktop.org/archives/nouveau/2021-April/038451.html.
>
> Whether `ret` should be `-ENOSPC` or `-ENOMEM` is hard to say as
> `nouveau_get_backlight_name()` could fail due to either.
>
> I will propose an alternative fix which modifies `nouveau_get_backlight_name()`
> to return an int so the actual error code can be propagated back instead of
> guessed, as well as fix an ida ID leak which I just spotted.
It's a good idea.
>
> Best,
> Pierre
>
> On 2021-05-08 — 11:48, Zhen Lei wrote:
>> Fix to return a negative error code from the error handling case instead
>> of 0, as done elsewhere in this function.
>>
>> Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/gpu/drm/nouveau/nouveau_backlight.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c
>> index 72f35a2babcb..097ca344a086 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
>> @@ -273,6 +273,7 @@ nouveau_backlight_init(struct drm_connector *connector)
>> return -ENOMEM;
>>
>> if (!nouveau_get_backlight_name(backlight_name, bl)) {
>> + ret = -ENOSPC;
>> NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
>> goto fail_alloc;
>> }
>> --
>> 2.25.1
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-08 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 3:48 [PATCH 1/1] drm/nouveau: fix error return code in nouveau_backlight_init() Zhen Lei
2021-05-08 7:34 ` Pierre Moreau
2021-05-08 9:18 ` Leizhen (ThunderTown)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).