diff mbox series

Initialize symbol 'entity' in sched_main.c

Message ID 20240817162026.84761-1-kdipendra88@gmail.com (mailing list archive)
State New, archived
Headers show
Series Initialize symbol 'entity' in sched_main.c | expand

Commit Message

Dipendra Khadka Aug. 17, 2024, 4:20 p.m. UTC
smatch reported following error:

'''
staging/drivers/gpu/drm/scheduler/sched_main.c:1063 drm_sched_select_entity() error: uninitialized symbol 'entity'.
'''

The symbol entity is initialized.

Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Brost Aug. 18, 2024, 3:49 a.m. UTC | #1
On Sat, Aug 17, 2024 at 04:20:24PM +0000, Dipendra Khadka wrote:
> smatch reported following error:
> 
> '''
> staging/drivers/gpu/drm/scheduler/sched_main.c:1063 drm_sched_select_entity() error: uninitialized symbol 'entity'.
> '''
> 
> The symbol entity is initialized.
> 

Looks like false postive, no opposed merging it but since
'sched->num_rqs' must be greater than zero it entity should always be
set unless I'm missing something.

Matt

> Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 7e90c9f95611..dcfd4d0f7c6e 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -1047,7 +1047,7 @@ void drm_sched_wakeup(struct drm_gpu_scheduler *sched,
>  static struct drm_sched_entity *
>  drm_sched_select_entity(struct drm_gpu_scheduler *sched)
>  {
> -	struct drm_sched_entity *entity;
> +	struct drm_sched_entity *entity = NULL;
>  	int i;
>  
>  	/* Start with the highest priority.
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 7e90c9f95611..dcfd4d0f7c6e 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -1047,7 +1047,7 @@  void drm_sched_wakeup(struct drm_gpu_scheduler *sched,
 static struct drm_sched_entity *
 drm_sched_select_entity(struct drm_gpu_scheduler *sched)
 {
-	struct drm_sched_entity *entity;
+	struct drm_sched_entity *entity = NULL;
 	int i;
 
 	/* Start with the highest priority.