dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dmitry.baryshkov@linaro.org
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/msm/dpu: merge struct dpu_irq into struct dpu_hw_intr
Date: Tue, 16 Nov 2021 15:19:09 +0300	[thread overview]
Message-ID: <20211116121909.GA17234@kili> (raw)

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

                 reply	other threads:[~2021-11-16 12:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211116121909.GA17234@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox