[1/2] drm/sun4i: Make sure clk_init_data is fully initialized

Message ID 0f37278d04c02461e17f42032a379dccfb773171.1787239944.git.geert+renesas@glider.be (mailing list archive)
State New
Headers
Series drm: Make sure clk_init_data is fully initialized |

Commit Message

Geert Uytterhoeven Aug. 21, 2026, 10:03 a.m. UTC
The clk_init_data structure contains several mutually-exclusive members
for different methods to specify the possible parents of a clock,
prompting drivers to initialize only the members they need.  However,
not initializing all members may cause subtle issues, which are only
exposed when CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_NONE is
enabled.

Make sure all members are fully initialized, to avoid such bugs, and to
prevent future breakage when converting drivers to a different method
for specifying the parents.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Compile-tested only.
---
 drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c  | 2 +-
 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c     | 2 +-
 drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Chen-Yu Tsai Aug. 21, 2026, 1:41 p.m. UTC | #1
On Fri, Aug 21, 2026 at 6:03 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> The clk_init_data structure contains several mutually-exclusive members
> for different methods to specify the possible parents of a clock,
> prompting drivers to initialize only the members they need.  However,
> not initializing all members may cause subtle issues, which are only
> exposed when CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_NONE is
> enabled.
>
> Make sure all members are fully initialized, to avoid such bugs, and to
> prevent future breakage when converting drivers to a different method
> for specifying the parents.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Acked-by: Chen-Yu Tsai <wens@kernel.org>
  

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
index b1beadb9bb59f8ff..958099d137f8df9b 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
@@ -109,7 +109,7 @@  static const struct clk_ops sun4i_ddc_ops = {
 
 int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *parent)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct sun4i_ddc *ddc;
 	const char *parent_name;
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
index fbf7da9d9592141b..15b09d5479d97aa3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
@@ -202,7 +202,7 @@  static const struct clk_ops sun4i_tmds_ops = {
 
 int sun4i_tmds_create(struct sun4i_hdmi *hdmi)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct sun4i_tmds *tmds;
 	const char *parents[2];
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
index 4afb12bd5281f0d1..bdac1d622cc41351 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c
@@ -167,7 +167,7 @@  static const struct clk_ops sun4i_dclk_ops = {
 int sun4i_dclk_create(struct device *dev, struct sun4i_tcon *tcon)
 {
 	const char *clk_name, *parent_name;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct sun4i_dclk *dclk;
 	int ret;
 
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
index a4d31fe3abff1ab1..bd0dba95421b3d8e 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy_clk.c
@@ -143,7 +143,7 @@  static const struct clk_ops sun8i_phy_clk_ops = {
 int sun8i_phy_clk_create(struct sun8i_hdmi_phy *phy, struct device *dev,
 			 bool second_parent)
 {
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct sun8i_phy_clk *priv;
 	const char *parents[2];