clk: renesas: Zero init clk_init_data
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 26 Mar 2021 10:54:34 +0000 (11:54 +0100)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 30 Mar 2021 07:58:27 +0000 (09:58 +0200)
As clk_core_populate_parent_map() checks clk_init_data.num_parents
first, and checks clk_init_data.parent_names[] before
clk_init_data.parent_data[] and clk_init_data.parent_hws[], leaving the
latter uninitialized doesn't do harm for now.  However, it is better to
play it safe, and initialize all clk_init_data structures to zeroes, to
avoid any current and future members containing uninitialized data.

Remove a few explicit zero initializers, which are now superfluous.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20210326105434.1574796-1-geert+renesas@glider.be
drivers/clk/renesas/clk-div6.c
drivers/clk/renesas/clk-mstp.c
drivers/clk/renesas/r9a06g032-clocks.c
drivers/clk/renesas/rcar-cpg-lib.c
drivers/clk/renesas/rcar-gen2-cpg.c
drivers/clk/renesas/rcar-gen3-cpg.c
drivers/clk/renesas/rcar-usb2-clock-sel.c
drivers/clk/renesas/renesas-cpg-mssr.c

index 5ca183e701667b462599a7af3fbb47691fb910bb..8fb68e703a6bab8c6f03eba17b2ed7aeac75274f 100644 (file)
@@ -216,7 +216,7 @@ struct clk * __init cpg_div6_register(const char *name,
                                      struct raw_notifier_head *notifiers)
 {
        unsigned int valid_parents;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct div6_clock *clock;
        struct clk *clk;
        unsigned int i;
@@ -267,7 +267,6 @@ struct clk * __init cpg_div6_register(const char *name,
        /* Register the clock. */
        init.name = name;
        init.ops = &cpg_div6_clock_ops;
-       init.flags = 0;
        init.parent_names = parent_names;
        init.num_parents = valid_parents;
 
index 003e9ce457570b3f45865296902e2e705ef3e320..90804ac06fa538c683773c9b1a0c0a0bdfafa015 100644 (file)
@@ -150,7 +150,7 @@ static struct clk * __init cpg_mstp_clock_register(const char *name,
        const char *parent_name, unsigned int index,
        struct mstp_clock_group *group)
 {
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct mstp_clock *clock;
        struct clk *clk;
 
index 1fe166e7f8bdcabae0f3505aa047c8cdada6d59f..71b11443f6fc38012c381839b9999f25b84104c8 100644 (file)
@@ -504,7 +504,7 @@ r9a06g032_register_gate(struct r9a06g032_priv *clocks,
 {
        struct clk *clk;
        struct r9a06g032_clk_gate *g;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
 
        g = kzalloc(sizeof(*g), GFP_KERNEL);
        if (!g)
@@ -674,7 +674,7 @@ r9a06g032_register_div(struct r9a06g032_priv *clocks,
 {
        struct r9a06g032_clk_div *div;
        struct clk *clk;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        unsigned int i;
 
        div = kzalloc(sizeof(*div), GFP_KERNEL);
@@ -758,7 +758,7 @@ r9a06g032_register_bitsel(struct r9a06g032_priv *clocks,
 {
        struct clk *clk;
        struct r9a06g032_clk_bitsel *g;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        const char *names[2];
 
        /* allocate the gate */
@@ -849,7 +849,7 @@ r9a06g032_register_dualgate(struct r9a06g032_priv *clocks,
 {
        struct r9a06g032_clk_dualgate *g;
        struct clk *clk;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
 
        /* allocate the gate */
        g = kzalloc(sizeof(*g), GFP_KERNEL);
index 7e7e5d1341d5e80c6b02af145d129f9ff8eed3b9..5678768ee1f2ca5830a057daac2b520a6d9157b6 100644 (file)
@@ -226,7 +226,7 @@ struct clk * __init cpg_sd_clk_register(const char *name,
        void __iomem *base, unsigned int offset, const char *parent_name,
        struct raw_notifier_head *notifiers, bool skip_first)
 {
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct sd_clock *clock;
        struct clk *clk;
        u32 val;
index d4fa3dc3e2a2632fe66f7460635973101258e8d0..edae874fa2b63369a0e43227fa73c68fd48a179f 100644 (file)
@@ -137,7 +137,7 @@ static struct clk * __init cpg_z_clk_register(const char *name,
                                              const char *parent_name,
                                              void __iomem *base)
 {
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct cpg_z_clk *zclk;
        struct clk *clk;
 
@@ -147,7 +147,6 @@ static struct clk * __init cpg_z_clk_register(const char *name,
 
        init.name = name;
        init.ops = &cpg_z_clk_ops;
-       init.flags = 0;
        init.parent_names = &parent_name;
        init.num_parents = 1;
 
index 17826599e9dd0e02da6eb767414c6a1bcb79e1e6..caa0f9414e45fe73719837d7ba780f11e94874ed 100644 (file)
@@ -143,7 +143,7 @@ static struct clk * __init cpg_z_clk_register(const char *name,
                                              unsigned int div,
                                              unsigned int offset)
 {
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct cpg_z_clk *zclk;
        struct clk *clk;
 
index 3abafd78f7c8a5701a8093f7cb67d38d42d85ef9..34a85dc95beb87a929ce791880da5271da991794 100644 (file)
@@ -144,7 +144,7 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
        struct device_node *np = dev->of_node;
        struct usb2_clock_sel_priv *priv;
        struct clk *clk;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        int ret;
 
        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -188,9 +188,6 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
 
        init.name = "rcar_usb2_clock_sel";
        init.ops = &usb2_clock_sel_clock_ops;
-       init.flags = 0;
-       init.parent_names = NULL;
-       init.num_parents = 0;
        priv->hw.init = &init;
 
        clk = clk_register(NULL, &priv->hw);
index bffbc3d2faf5fa16c8912173c54714d053e07ec8..fc531d35b269d3cd171388af05ac3b198377cb3f 100644 (file)
@@ -408,7 +408,7 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
        struct mstp_clock *clock = NULL;
        struct device *dev = priv->dev;
        unsigned int id = mod->id;
-       struct clk_init_data init;
+       struct clk_init_data init = {};
        struct clk *parent, *clk;
        const char *parent_name;
        unsigned int i;