mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Sascha Hauer" <s.hauer@pengutronix.de>
Cc: Detlev Casanova <detlev.casanova@collabora.com>,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: [BUG] drm/rockchip: vop2: uninitialized variables passed to ilog2 and writel
Date: Thu, 13 Mar 2025 09:33:12 +0100	[thread overview]
Message-ID: <7ba2e429-113d-4e1c-968b-ffbe65bcf9f4@pengutronix.de> (raw)

Hi,

Running clang-analyzer[1] on the VOP2 driver in barebox[2], which was ported
from Linux reports that following variables:

  dclk_out_div, if_pixclk_div, if_dclk_div

defined in rk3588_set_intf_mux() and passed to rk3588_calc_cru_cfg()
are given as uninitialized arguments to ilog2() and in some cases even
used afterwards unconditionally (outside of error cases):

  - dclk_out_div: is not initialized in the HDMI, eDP and DPI cases,
    but is passed to ilog2 unconditionally and the result is written
    into the RK3588_VP_CLK_CTRL register

  - if_pixclk_div: is not initialized in the DP and DPI cases,
    but is passed to ilog2 unconditionally.
    However, the result seems unused.

  - if_clk_div: is not initialized in the DP, MIPI and DPI cases,
    but is passed to ilog2 unconditionally.
    However, the result seems unused.

I checked against Linux v6.14-rc6.

I am not fully sure what a suitable default value would be for the first
case, which is why I report this without a patch.

[1]: https://lore.kernel.org/barebox/20250313080950.3222757-1-a.fatoum@pengutronix.de/T/#m78ca98c01b73ef7fe3316e73ce62cfe4b2c111d0
[2]: https://github.com/barebox/barebox/blob/v2025.02.0/drivers/video/rockchip/rockchip_drm_vop2.c

Thanks,
Ahmad
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




                 reply	other threads:[~2025-03-13  8:35 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=7ba2e429-113d-4e1c-968b-ffbe65bcf9f4@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=andy.yan@rock-chips.com \
    --cc=barebox@lists.infradead.org \
    --cc=detlev.casanova@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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