From: Jia Jie Ho <jiajie.ho@starfivetech.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, <oe-kbuild@lists.linux.dev>
Cc: <lkp@intel.com>, <oe-kbuild-all@lists.linux.dev>,
<linux-kernel@vger.kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
Date: Mon, 20 Nov 2023 23:02:04 +0800 [thread overview]
Message-ID: <3665caf1-d36a-40c8-9995-89d4064ac467@starfivetech.com> (raw)
In-Reply-To: <e9e60d3b-77db-4b5d-ae63-b5454f61a59f@suswa.mountain>
On 20/11/2023 10:22 pm, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
> commit: c388f458bc34eb3a5728b67f6614f9375cd99087 hwrng: starfive - Add TRNG driver for StarFive SoC
> config: riscv-randconfig-r071-20231112 (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/config)
> compiler: riscv64-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> | Closes: https://lore.kernel.org/r/202311160649.3GhKCfhd-lkp@intel.com/
>
> smatch warnings:
> drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
>
> vim +/dev_err_probe +303 drivers/char/hw_random/jh7110-trng.c
>
> c388f458bc34eb Jia Jie Ho 2023-01-17 274 static int starfive_trng_probe(struct platform_device *pdev)
> c388f458bc34eb Jia Jie Ho 2023-01-17 275 {
> c388f458bc34eb Jia Jie Ho 2023-01-17 276 int ret;
> c388f458bc34eb Jia Jie Ho 2023-01-17 277 int irq;
> c388f458bc34eb Jia Jie Ho 2023-01-17 278 struct starfive_trng *trng;
> c388f458bc34eb Jia Jie Ho 2023-01-17 279
> c388f458bc34eb Jia Jie Ho 2023-01-17 280 trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
> c388f458bc34eb Jia Jie Ho 2023-01-17 281 if (!trng)
> c388f458bc34eb Jia Jie Ho 2023-01-17 282 return -ENOMEM;
> c388f458bc34eb Jia Jie Ho 2023-01-17 283
> c388f458bc34eb Jia Jie Ho 2023-01-17 284 platform_set_drvdata(pdev, trng);
> c388f458bc34eb Jia Jie Ho 2023-01-17 285 trng->dev = &pdev->dev;
> c388f458bc34eb Jia Jie Ho 2023-01-17 286
> c388f458bc34eb Jia Jie Ho 2023-01-17 287 trng->base = devm_platform_ioremap_resource(pdev, 0);
> c388f458bc34eb Jia Jie Ho 2023-01-17 288 if (IS_ERR(trng->base))
> c388f458bc34eb Jia Jie Ho 2023-01-17 289 return dev_err_probe(&pdev->dev, PTR_ERR(trng->base),
> c388f458bc34eb Jia Jie Ho 2023-01-17 290 "Error remapping memory for platform device.\n");
> c388f458bc34eb Jia Jie Ho 2023-01-17 291
> c388f458bc34eb Jia Jie Ho 2023-01-17 292 irq = platform_get_irq(pdev, 0);
> c388f458bc34eb Jia Jie Ho 2023-01-17 293 if (irq < 0)
> c388f458bc34eb Jia Jie Ho 2023-01-17 294 return irq;
> c388f458bc34eb Jia Jie Ho 2023-01-17 295
> c388f458bc34eb Jia Jie Ho 2023-01-17 296 init_completion(&trng->random_done);
> c388f458bc34eb Jia Jie Ho 2023-01-17 297 init_completion(&trng->reseed_done);
> c388f458bc34eb Jia Jie Ho 2023-01-17 298 spin_lock_init(&trng->write_lock);
> c388f458bc34eb Jia Jie Ho 2023-01-17 299
> c388f458bc34eb Jia Jie Ho 2023-01-17 300 ret = devm_request_irq(&pdev->dev, irq, starfive_trng_irq, 0, pdev->name,
> c388f458bc34eb Jia Jie Ho 2023-01-17 301 (void *)trng);
> c388f458bc34eb Jia Jie Ho 2023-01-17 302 if (ret)
> c388f458bc34eb Jia Jie Ho 2023-01-17 @303 return dev_err_probe(&pdev->dev, irq,
> ^^^
> Should be "ret". Weird how we're getting this warning in November when
> the code is from Jan... Looks like the bug is still their in linux-next
> though.
>
I'll submit a patch for this.
Thanks,
Jia Jie
prev parent reply other threads:[~2023-11-20 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 14:22 Dan Carpenter
2023-11-20 15:02 ` Jia Jie Ho [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=3665caf1-d36a-40c8-9995-89d4064ac467@starfivetech.com \
--to=jiajie.ho@starfivetech.com \
--cc=dan.carpenter@linaro.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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
all inboxes | Powered by JetHome®