Skip to contentSkip to conversation

drm/msm: Add SDM845 DPU support

bug report Dan Carpenter 2 participants 3 messages Oct 1, 2018 – Oct 5, 2018

lore
Share & tools
lore
#0 lore raw

Hello Jeykumar Sankaran,

The patch 25fdd5933e4c: "drm/msm: Add SDM845 DPU support" from Jun 27, 2018, leads to the following static checker warning:

	drivers/gpu/drm/msm/msm_drv.c:562 msm_drm_init()
	warn: 'priv->disp_thread[i].thread' isn't an ERR_PTR

drivers/gpu/drm/msm/msm_drv.c
540 /**

   541           * this priority was found during empiric testing to have appropriate
   542           * realtime scheduling to process display updates and interact with
   543           * other real time and normal priority task
   544           */
   545          param.sched_priority = 16;
   546          for (i = 0; i < priv->num_crtcs; i++) {
   547  
   548                  /* initialize display thread */
   549                  priv->disp_thread[i].crtc_id = priv->crtcs[i]->base.id;
   550                  kthread_init_worker(&priv->disp_thread[i].worker);
   551                  priv->disp_thread[i].dev = ddev;
   552                  priv->disp_thread[i].thread =
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

553 kthread_run(kthread_worker_fn,
554 &priv->disp_thread[i].worker,
555 "crtc_commit:%d", priv->disp_thread[i].crtc_id);
556 ret = sched_setscheduler(priv->disp_thread[i].thread,

                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Only pass valid pointers to this because it's going to dereference it.

557 SCHED_FIFO, &param);
558 if (ret)
559 pr_warn("display thread priority update failed: %d\n",
560 ret);
561

   562                  if (IS_ERR(priv->disp_thread[i].thread)) {
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Too late.

   563                          dev_err(dev, "failed to create crtc_commit kthread\n");
   564                          priv->disp_thread[i].thread = NULL;
   565                  }
   566  
   567                  /* initialize event thread */
   568                  priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;
   569                  kthread_init_worker(&priv->event_thread[i].worker);
   570                  priv->event_thread[i].dev = ddev;
   571                  priv->event_thread[i].thread =
   572                          kthread_run(kthread_worker_fn,
   573                                  &priv->event_thread[i].worker,
   574                                  "crtc_event:%d", priv->event_thread[i].crtc_id);

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 8 lines · Dan Carpenter

Hello Jeykumar Sankaran,

The patch 25fdd5933e4c: "drm/msm: Add SDM845 DPU support" from Jun 27, 2018, leads to the following static checker warning:

	drivers/gpu/drm/msm/msm_drv.c:562 msm_drm_init()
	warn: 'priv->disp_thread[i].thread' isn't an ERR_PTR

See also:

drivers/gpu/drm/msm/msm_drv.c:588 msm_drm_init() warn: 'priv->event_thread[i].thread' isn't an ERR_PTR

a bit later in the function.

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Dan Carpenter

Thanks for reporting the issue Dan. Posted the patch below as the fix.

https://patchwork.freedesktop.org/series/50637/

Thanks and Regards,
Jeykumar S.

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Monday, October 1, 2018 2:39 AM
To: [email protected]
Cc: [email protected]
Subject: [bug report] drm/msm: Add SDM845 DPU support

Hello Jeykumar Sankaran,

The patch 25fdd5933e4c: "drm/msm: Add SDM845 DPU support" from Jun 27, 2018, leads to the following static checker warning:

	drivers/gpu/drm/msm/msm_drv.c:562 msm_drm_init()
	warn: 'priv->disp_thread[i].thread' isn't an ERR_PTR

drivers/gpu/drm/msm/msm_drv.c
540 /**
541 * this priority was found during empiric testing to have
appropriate
542 * realtime scheduling to process display updates and
interact with
543 * other real time and normal priority task
544 */
545 param.sched_priority = 16;
546 for (i = 0; i < priv->num_crtcs; i++) {
547
548 /* initialize display thread */
549 priv->disp_thread[i].crtc_id =
priv->crtcs[i]->base.id;

   550                  kthread_init_worker(&priv->disp_thread[i].worker);
   551                  priv->disp_thread[i].dev = ddev;
   552                  priv->disp_thread[i].thread =
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

553 kthread_run(kthread_worker_fn,
554 &priv->disp_thread[i].worker,
555 "crtc_commit:%d",
priv->disp_thread[i].crtc_id);
556 ret =
sched_setscheduler(priv->disp_thread[i].thread,

                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Only pass valid pointers to this because it's going to dereference it.

557 SCHED_FIFO,
&param);
558 if (ret)
559 pr_warn("display thread priority update
failed: %d\n",
560
ret);
561

   562                  if (IS_ERR(priv->disp_thread[i].thread)) {
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Too late.

563 dev_err(dev, "failed to create crtc_commit
kthread\n");
564 priv->disp_thread[i].thread = NULL;
565 }
566
567 /* initialize event thread */
568 priv->event_thread[i].crtc_id =
priv->crtcs[i]->base.id;

   569                  kthread_init_worker(&priv->event_thread[i].worker);
   570                  priv->event_thread[i].dev = ddev;
   571                  priv->event_thread[i].thread =

572 kthread_run(kthread_worker_fn,
573 &priv->event_thread[i].worker,
574 "crtc_event:%d",
priv->event_thread[i].crtc_id);

regards,
dan carpenter

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel