clk: at91: 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.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Message-ID: <f402b659481b7e5abe90340bb43adc427cdfe70f.1787239813.git.geert+renesas@glider.be>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
Geert Uytterhoeven 2026-08-21 10:53:12 +02:00 committed by Brian Masney
parent 53c4586386
commit 16f9dc4296
9 changed files with 12 additions and 12 deletions

View File

@ -486,8 +486,8 @@ struct clk_hw * __init
at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name,
const char *parent_name)
{
struct clk_init_data init = {};
struct clk_audio_pad *apad_ck;
struct clk_init_data init;
int ret;
apad_ck = kzalloc_obj(*apad_ck);
@ -517,8 +517,8 @@ struct clk_hw * __init
at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name,
const char *parent_name)
{
struct clk_init_data init = {};
struct clk_audio_pmc *apmc_ck;
struct clk_init_data init;
int ret;
apmc_ck = kzalloc_obj(*apmc_ck);

View File

@ -97,7 +97,7 @@ at91_clk_register_h32mx(struct regmap *regmap, const char *name,
const char *parent_name)
{
struct clk_sama5d4_h32mx *h32mxclk;
struct clk_init_data init;
struct clk_init_data init = {};
int ret;
h32mxclk = kzalloc_obj(*h32mxclk);

View File

@ -298,8 +298,8 @@ at91_clk_register_main_rc_osc(struct regmap *regmap,
const char *name,
u32 frequency, u32 accuracy)
{
struct clk_init_data init = {};
struct clk_main_rc_osc *osc;
struct clk_init_data init;
struct clk_hw *hw;
int ret;

View File

@ -318,7 +318,7 @@ at91_clk_register_pll(struct regmap *regmap, const char *name,
{
struct clk_pll *pll;
struct clk_hw *hw;
struct clk_init_data init;
struct clk_init_data init = {};
int offset = PLL_REG(id);
unsigned int pllr;
int ret;

View File

@ -86,9 +86,9 @@ struct clk_hw * __init
at91_clk_register_plldiv(struct regmap *regmap, const char *name,
const char *parent_name)
{
struct clk_init_data init = {};
struct clk_plldiv *plldiv;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
plldiv = kzalloc_obj(*plldiv);

View File

@ -42,8 +42,8 @@ at91_clk_register_sam9260_slow(struct regmap *regmap,
int num_parents)
{
struct clk_sam9260_slow *slowck;
struct clk_init_data init = {};
struct clk_hw *hw;
struct clk_init_data init;
int ret;
if (!name)

View File

@ -113,9 +113,9 @@ struct clk_hw * __init
at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
const char **parent_names, u8 num_parents)
{
struct clk_init_data init = {};
struct at91sam9x5_clk_smd *smd;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
smd = kzalloc_obj(*smd);

View File

@ -224,9 +224,9 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
const char **parent_names, u8 num_parents,
u32 usbs_mask)
{
struct clk_init_data init = {};
struct at91sam9x5_clk_usb *usb;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
usb = kzalloc_obj(*usb);
@ -275,9 +275,9 @@ struct clk_hw * __init
at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name,
const char *parent_name)
{
struct clk_init_data init = {};
struct at91sam9x5_clk_usb *usb;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
usb = kzalloc_obj(*usb);
@ -394,9 +394,9 @@ struct clk_hw * __init
at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
const char *parent_name, const u32 *divisors)
{
struct clk_init_data init = {};
struct at91rm9200_clk_usb *usb;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
usb = kzalloc_obj(*usb);

View File

@ -231,9 +231,9 @@ at91_clk_register_slow_rc_osc(void __iomem *sckcr,
unsigned long startup,
const struct clk_slow_bits *bits)
{
struct clk_init_data init = {};
struct clk_slow_rc_osc *osc;
struct clk_hw *hw;
struct clk_init_data init;
int ret;
if (!sckcr || !name)