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/clk/hisilicon/clk-hi3559a.c | 2 +-
drivers/clk/hisilicon/clk-hi3620.c | 2 +-
drivers/clk/hisilicon/clk-hi6220-stub.c | 2 +-
drivers/clk/hisilicon/clk-hisi-phase.c | 2 +-
drivers/clk/hisilicon/clk-hix5hd2.c | 2 +-
drivers/clk/hisilicon/clkdivider-hi6220.c | 2 +-
drivers/clk/hisilicon/clkgate-separated.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
@@ -456,8 +456,8 @@ static void hisi_clk_register_pll(struct hi3559av100_pll_clock *clks,
{
void __iomem *base = data->base;
struct hi3559av100_clk_pll *p_clk = NULL;
+ struct clk_init_data init = {};
struct clk *clk = NULL;
- struct clk_init_data init;
int i;
p_clk = devm_kcalloc(dev, nums, sizeof(*p_clk), GFP_KERNEL);
@@ -410,9 +410,9 @@ static const struct clk_ops clk_mmc_ops = {
static struct clk *hisi_register_clk_mmc(struct hisi_mmc_clock *mmc_clk,
void __iomem *base, struct device_node *np)
{
+ struct clk_init_data init = {};
struct clk_mmc *mclk;
struct clk *clk;
- struct clk_init_data init;
mclk = kzalloc_obj(*mclk);
if (!mclk)
@@ -195,7 +195,7 @@ static const struct clk_ops hi6220_stub_clk_ops = {
static int hi6220_stub_clk_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct hi6220_stub_clk *stub_clk;
struct clk *clk;
struct device_node *np = pdev->dev.of_node;
@@ -94,8 +94,8 @@ struct clk *clk_register_hisi_phase(struct device *dev,
const struct hisi_phase_clock *clks,
void __iomem *base, spinlock_t *lock)
{
+ struct clk_init_data init = {};
struct clk_hisi_phase *phase;
- struct clk_init_data init;
phase = devm_kzalloc(dev, sizeof(struct clk_hisi_phase), GFP_KERNEL);
if (!phase)
@@ -258,8 +258,8 @@ hix5hd2_clk_register_complex(struct hix5hd2_complex_clock *clks, int nums,
for (i = 0; i < nums; i++) {
struct hix5hd2_clk_complex *p_clk;
+ struct clk_init_data init = {};
struct clk *clk;
- struct clk_init_data init;
p_clk = kzalloc_obj(*p_clk);
if (!p_clk)
@@ -103,7 +103,7 @@ struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
{
struct hi6220_clk_divider *div;
struct clk *clk;
- struct clk_init_data init;
+ struct clk_init_data init = {};
struct clk_div_table *table;
u32 max_div, min_div;
int i;
@@ -87,8 +87,8 @@ struct clk *hisi_register_clkgate_sep(struct device *dev, const char *name,
u8 clk_gate_flags, spinlock_t *lock)
{
struct clkgate_separated *sclk;
+ struct clk_init_data init = {};
struct clk *clk;
- struct clk_init_data init;
sclk = kzalloc_obj(*sclk);
if (!sclk)