From: Dan Carpenter <dan.carpenter@linaro.org>
To: Adam Ford <aford173@gmail.com>
Cc: linux-phy@lists.infradead.org
Subject: [bug report] phy: freescale: fsl-samsung-hdmi: Support dynamic integer
Date: Mon, 21 Oct 2024 12:14:47 +0300 [thread overview]
Message-ID: <7cf05309-5324-4225-bedf-73f3f577de54@stanley.mountain> (raw)
Hello Adam Ford,
Commit 1951dbb41d1d ("phy: freescale: fsl-samsung-hdmi: Support
dynamic integer") from Sep 14, 2024 (linux-next), leads to the
following Smatch static checker warning:
drivers/phy/freescale/phy-fsl-samsung-hdmi.c:510 fsl_samsung_hdmi_phy_lookup_rate()
error: iterator underflow 'phy_pll_cfg' (-1)-69
drivers/phy/freescale/phy-fsl-samsung-hdmi.c
501 static const struct phy_config *fsl_samsung_hdmi_phy_lookup_rate(unsigned long rate)
502 {
503 int i;
504
505 /* Search the lookup table */
506 for (i = ARRAY_SIZE(phy_pll_cfg) - 1; i >= 0; i--)
^^^^^^
What about if we just made the condition "i > 0" here and defaulted to the first
element in the array?
507 if (phy_pll_cfg[i].pixclk <= rate)
508 break;
509
--> 510 return &phy_pll_cfg[i];
Or another idea could but the check for if (i == -1) at the end of the loop.
511 }
regards,
dan carpenter
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
reply other threads:[~2024-10-21 9:15 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=7cf05309-5324-4225-bedf-73f3f577de54@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=aford173@gmail.com \
--cc=linux-phy@lists.infradead.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