public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: dmaengine@vger.kernel.org
Subject: [bug report] dmaengine: loongson: New driver for the Loongson Multi-Channel DMA controller
Date: Fri, 10 Apr 2026 13:10:44 +0300	[thread overview]
Message-ID: <adjMpFUpBwnsA9kv@stanley.mountain> (raw)

Hello Binbin Zhou,

Commit 1c0028e725f1 ("dmaengine: loongson: New driver for the
Loongson Multi-Channel DMA controller") from Mar 7, 2026
(linux-next), leads to the following Smatch static checker warning:

	drivers/dma/loongson/loongson2-apb-cmc-dma.c:677 loongson2_cmc_dma_probe()
	warn: unsigned 'lchan->irq' is never less than zero.

drivers/dma/loongson/loongson2-apb-cmc-dma.c
    669         ret = dmaenginem_async_device_register(ddev);
    670         if (ret)
    671                 return dev_err_probe(dev, ret, "Failed to register DMA engine device.\n");
    672 
    673         for (i = 0; i < nr_chans; i++) {
    674                 lchan = &lddev->chan[i];
    675 
    676                 lchan->irq = platform_get_irq(pdev, i);
--> 677                 if (lchan->irq < 0)

lchan->irq is unsigned so the error checking doesn't work

    678                         return lchan->irq;
    679 
    680                 ret = devm_request_irq(dev, lchan->irq, loongson2_cmc_dma_chan_irq, IRQF_SHARED,
    681                                        dev_name(chan2dev(lchan)), lchan);
    682                 if (ret)
    683                         return ret;
    684         }
    685 
    686         ret = loongson2_cmc_dma_acpi_controller_register(lddev);
    687         if (ret)
    688                 return dev_err_probe(dev, ret, "Failed to register dma controller with ACPI.\n");
    689 
    690         ret = loongson2_cmc_dma_of_controller_register(lddev);
    691         if (ret)

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10 10:10 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=adjMpFUpBwnsA9kv@stanley.mountain \
    --to=error27@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=zhoubinbin@loongson.cn \
    /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