diff mbox series

drm/nouveau/gr/gf100: Fix missing unlock in gf100_gr_chan_new()

Message ID 20241026173844.2392679-1-lihuafei1@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/nouveau/gr/gf100: Fix missing unlock in gf100_gr_chan_new() | expand

Commit Message

Li Huafei Oct. 26, 2024, 5:38 p.m. UTC
When the call to gf100_grctx_generate() fails, unlock gr->fecs.mutex
before returning the error.

Fixes smatch warning:

drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c:480 gf100_gr_chan_new() warn: inconsistent returns '&gr->fecs.mutex'.

Fixes: ca081fff6ecc ("drm/nouveau/gr/gf100-: generate golden context during first object alloc")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lyude Paul Oct. 29, 2024, 6:42 p.m. UTC | #1
Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push upstream in a moment

On Sun, 2024-10-27 at 01:38 +0800, Li Huafei wrote:
> When the call to gf100_grctx_generate() fails, unlock gr->fecs.mutex
> before returning the error.
> 
> Fixes smatch warning:
> 
> drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c:480 gf100_gr_chan_new() warn: inconsistent returns '&gr->fecs.mutex'.
> 
> Fixes: ca081fff6ecc ("drm/nouveau/gr/gf100-: generate golden context during first object alloc")
> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
> index 060c74a80eb1..3ea447f6a45b 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
> @@ -443,6 +443,7 @@ gf100_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch,
>  		ret = gf100_grctx_generate(gr, chan, fifoch->inst);
>  		if (ret) {
>  			nvkm_error(&base->engine.subdev, "failed to construct context\n");
> +			mutex_unlock(&gr->fecs.mutex);
>  			return ret;
>  		}
>  	}
Li Huafei Oct. 31, 2024, 2:04 a.m. UTC | #2
On 2024/10/30 2:42, Lyude Paul wrote:
> Reviewed-by: Lyude Paul <lyude@redhat.com>
> 
> Will push upstream in a moment
>
Thank you for reviewing.

Thanks,
Huafei
> On Sun, 2024-10-27 at 01:38 +0800, Li Huafei wrote:
>> When the call to gf100_grctx_generate() fails, unlock gr->fecs.mutex
>> before returning the error.
>>
>> Fixes smatch warning:
>>
>> drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c:480 gf100_gr_chan_new() warn: inconsistent returns '&gr->fecs.mutex'.
>>
>> Fixes: ca081fff6ecc ("drm/nouveau/gr/gf100-: generate golden context during first object alloc")
>> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
>> ---
>>  drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
>> index 060c74a80eb1..3ea447f6a45b 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
>> @@ -443,6 +443,7 @@ gf100_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch,
>>  		ret = gf100_grctx_generate(gr, chan, fifoch->inst);
>>  		if (ret) {
>>  			nvkm_error(&base->engine.subdev, "failed to construct context\n");
>> +			mutex_unlock(&gr->fecs.mutex);
>>  			return ret;
>>  		}
>>  	}
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
index 060c74a80eb1..3ea447f6a45b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
@@ -443,6 +443,7 @@  gf100_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch,
 		ret = gf100_grctx_generate(gr, chan, fifoch->inst);
 		if (ret) {
 			nvkm_error(&base->engine.subdev, "failed to construct context\n");
+			mutex_unlock(&gr->fecs.mutex);
 			return ret;
 		}
 	}