Skip to contentSkip to conversation

iio: Make sure clk_init_data is fully initialized

PATCH In review Geert Uytterhoeven 4 participants 6 messages Aug 21 – Aug 24

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover iio: Make sure clk_init_data is fully initialized

Hi all,

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.

Hence this series aims to 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.

Part One[1] fixed all cases that I identified to be real bugs, in response to a crash I saw on BeagleBone Black.

This series is the IIO subpart of Part Two, which fixes remaining cases that are currently harmless. These are still fragile, and may cause future breakage when converting drivers to a different method for specifying the parents.

Thanks for your comments!

[1] "[PATCH treewide 0/5] clk: Make sure clk_init_data is fully initialized (part 1)"
https://lore.kernel.org/[email protected]

Geert Uytterhoeven (2):
iio: adc: meson-saradc: Make sure clk_init_data is fully initialized
iio: frequency: adf4350: Make sure clk_init_data is fully initialized

 drivers/iio/adc/meson_saradc.c  | 2 +-
 drivers/iio/frequency/adf4350.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 12 lines
2.43.0

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH 1/2 iio: adc: meson-saradc: Make sure clk_init_data is fully initialized

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.

---
Compile-tested only.

---
 drivers/iio/adc/meson_saradc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/meson_saradc.c +1 -1
index 000e39ca5c624eb6..7b89e2ecd0248b3a 100644
@@ -739,7 +739,7 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
 {
 	struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
 	struct device *dev = indio_dev->dev.parent;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	const char *clk_parents[1];
 
 	init.name = devm_kasprintf(dev, GFP_KERNEL, "%s#adc_div", dev_name(dev));
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] iio: adc: meson-saradc: Make sure clk_init_data is fully initialized

Quoted 7 lines · On Fri, 21 Aug 2026 12:04:06 +0200 Geert Uytterhoeven…

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.

Quoted 6 lines

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.

---

Signature · 2 lines
Kind regards,
Joshua Crofts
#3 lore raw

PATCH 2/2 iio: frequency: adf4350: Make sure clk_init_data is fully initialized

In reply to Geert Uytterhoeven

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.

---
Compile-tested only.

---
 drivers/iio/frequency/adf4350.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/adf4350.c +1 -1
index 315317d6eec412f6..2e1f55d652cb14e6 100644
@@ -461,7 +461,7 @@ static const struct clk_ops adf4350_clk_ops = {
 static int adf4350_clk_register(struct adf4350_state *st)
 {
 	struct spi_device *spi = st->spi;
-	struct clk_init_data init;
+	struct clk_init_data init = {};
 	struct clk *clk;
 	const char *parent_name;
 	int ret;
Signature · 1 line
2.43.0
maintainer
#4 lore raw
In reply to Geert Uytterhoeven
Quoted 21 lines · On Fri, 21 Aug 2026 12:04:05 +0200 Geert Uytterhoeven…

Hi all,

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.

Hence this series aims to 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.

Part One[1] fixed all cases that I identified to be real bugs, in response to a crash I saw on BeagleBone Black.

This series is the IIO subpart of Part Two, which fixes remaining cases that are currently harmless. These are still fragile, and may cause future breakage when converting drivers to a different method for specifying the parents.

Quoted 5 lines

Thanks for your comments!

[1] "[PATCH treewide 0/5] clk: Make sure clk_init_data is fully initialized (part 1)"
https://lore.kernel.org/[email protected]

Applied to the testing branch of iio.git.

I made a trivial tweak from {} to { } to follow the style we are trying to stick to for these in IIO.

Thanks,

Jonathan

Quoted 9 lines

Geert Uytterhoeven (2):
iio: adc: meson-saradc: Make sure clk_init_data is fully initialized
iio: frequency: adf4350: Make sure clk_init_data is fully initialized

 drivers/iio/adc/meson_saradc.c  | 2 +-
 drivers/iio/frequency/adf4350.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by on the v1 series
#5 lore raw
In reply to Geert Uytterhoeven
Quoted 13 lines · Geert Uytterhoeven

Hi all,

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.

Hence this series aims to 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.

Quoted 7 lines

Part One[1] fixed all cases that I identified to be real bugs, in response to a crash I saw on BeagleBone Black.

This series is the IIO subpart of Part Two, which fixes remaining cases that are currently harmless. These are still fragile, and may cause future breakage when converting drivers to a different method for specifying the parents.

For the series:

I see it was already picked up, and no need to add my tag unless you wanted to. Just providing an OK from the clk side.