All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: dmaengine@vger.kernel.org
Subject: Re: [bug report] dmaengine: qcom_hidma: simplify DT resource parsing
Date: Tue, 23 Apr 2024 10:42:45 -0500	[thread overview]
Message-ID: <CAL_Jsq+a1fsZMSPRrqw9_4=mcn7XD8WD+ziNXV-gaAzCzLEDOw@mail.gmail.com> (raw)
In-Reply-To: <71169d0e-e751-4c08-b6ce-36c37f63879c@moroto.mountain>

On Tue, Apr 23, 2024 at 9:32 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Hello Rob Herring,
>
> Commit 37fa4905d22a ("dmaengine: qcom_hidma: simplify DT resource
> parsing") from Jan 4, 2018 (linux-next), leads to the following
> Smatch static checker warning:
>
>         drivers/dma/qcom/hidma_mgmt.c:408 hidma_mgmt_of_populate_channels()
>         warn: both zero and negative are errors 'ret'
>
> drivers/dma/qcom/hidma_mgmt.c
>     348 static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
>     349 {
>     350         struct platform_device *pdev_parent = of_find_device_by_node(np);
>     351         struct platform_device_info pdevinfo;
>     352         struct device_node *child;
>     353         struct resource *res;
>     354         int ret = 0;
>     355
>     356         /* allocate a resource array */
>     357         res = kcalloc(3, sizeof(*res), GFP_KERNEL);
>     358         if (!res)
>     359                 return -ENOMEM;
>     360
>     361         for_each_available_child_of_node(np, child) {
>     362                 struct platform_device *new_pdev;
>     363
>     364                 ret = of_address_to_resource(child, 0, &res[0]);
>     365                 if (!ret)
>     366                         goto out;
>
> This if statement seems reversed.  It will exit with success on the
> first iteration through the loop.

Indeed! Obviously no one is using DT with this driver as it has been
broken since 2018. It's for a server platform as well, and DT usage is
rare to begin with on them (excluding all of IBM Power of course). So
I'll send patches removing DT support in this driver and the
associated binding.

Rob

      reply	other threads:[~2024-04-23 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 14:32 [bug report] dmaengine: qcom_hidma: simplify DT resource parsing Dan Carpenter
2024-04-23 15:42 ` Rob Herring [this message]

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='CAL_Jsq+a1fsZMSPRrqw9_4=mcn7XD8WD+ziNXV-gaAzCzLEDOw@mail.gmail.com' \
    --to=robh@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=dmaengine@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.