* [bug report] phy: freescale: fsl-samsung-hdmi: Support dynamic integer
@ 2024-10-21 9:14 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2024-10-21 9:14 UTC (permalink / raw)
To: Adam Ford; +Cc: linux-phy
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-21 9:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 9:14 [bug report] phy: freescale: fsl-samsung-hdmi: Support dynamic integer Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox