[bug report] drm/msm/dpu: merge struct dpu_irq into struct dpu_hw_intr
Dan Carpenter
dan.carpenter at oracle.com
Tue Nov 16 12:19:09 UTC 2021
Hello Dmitry Baryshkov,
The patch f25f656608e3: "drm/msm/dpu: merge struct dpu_irq into
struct dpu_hw_intr" from Jun 18, 2021, leads to the following Smatch
static checker warnings:
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c:569 dpu_core_irq_preinstall()
error: potential null dereference 'dpu_kms->hw_intr->irq_cb_tbl'. (kcalloc returns null)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c:570 dpu_core_irq_preinstall()
error: potential null dereference 'dpu_kms->hw_intr->irq_counts'. (kcalloc returns null)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
554 void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms)
555 {
556 int i;
557
558 pm_runtime_get_sync(&dpu_kms->pdev->dev);
559 dpu_clear_irqs(dpu_kms);
560 dpu_disable_all_irqs(dpu_kms);
561 pm_runtime_put_sync(&dpu_kms->pdev->dev);
562
563 /* Create irq callbacks for all possible irq_idx */
564 dpu_kms->hw_intr->irq_cb_tbl = kcalloc(dpu_kms->hw_intr->total_irqs,
565 sizeof(struct list_head), GFP_KERNEL);
566 dpu_kms->hw_intr->irq_counts = kcalloc(dpu_kms->hw_intr->total_irqs,
567 sizeof(atomic_t), GFP_KERNEL);
No checks for these kcallocs... It's not actually new code but shuffling
them around makes them show up as new in my tests.
568 for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
--> 569 INIT_LIST_HEAD(&dpu_kms->hw_intr->irq_cb_tbl[i]);
570 atomic_set(&dpu_kms->hw_intr->irq_counts[i], 0);
571 }
572 }
regards,
dan carpenter
More information about the dri-devel
mailing list