On 02/28/2014 03:22 AM, Tero Kristo wrote: [...] > +static void __init of_omap2_apll_setup(struct device_node *node) > +{ > + struct dpll_data *ad = NULL; > + struct clk_hw_omap *clk_hw = NULL; > + struct clk_init_data *init = NULL; > + struct clk *clk; > + const char *parent_name; > + u32 val; > + > + ad = kzalloc(sizeof(*clk_hw), GFP_KERNEL); > + clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); > + init = kzalloc(sizeof(*init), GFP_KERNEL); > + > + if (!ad || !clk_hw || !init) > + goto cleanup; > + > + clk_hw->dpll_data = ad; > + clk_hw->hw.init = init; > + init->ops = &omap2_apll_ops; > + init->name = node->name; > + clk_hw->ops = &omap2_apll_hwops; > + > + init->num_parents = of_clk_get_parent_count(node); > + if (init->num_parents != 1) { > + pr_err("%s must have one parent\n", node->name); > + goto cleanup; > + } > + > + parent_name = of_clk_get_parent_name(node, 0); > + init->parent_names = &parent_name; > + > + if (of_property_read_u32(node, "ti,clock-frequency", &val)) { > + pr_err("%s missing clock-frequency\n", node->name); > + goto cleanup; > + } > + clk_hw->fixed_rate = val; > + > + if (of_property_read_u32(node, "ti,bit-shift", &val)) { > + pr_err("%s missing bit-shift\n", node->name); > + goto cleanup; > + } > + > + clk_hw->enable_bit = val; > + ad->enable_mask = 0x3 << val; > + ad->autoidle_mask = 0x3 << val; > + > + if (of_property_read_u32(node, "ti,idlest-shift", &val)) { > + pr_err("%s missing idlest-shift\n", node->name); > + goto cleanup; > + } > + > + ad->idlest_mask = 1 << val; > + > + ad->control_reg = ti_clk_get_reg_addr(node, 0); > + ad->autoidle_reg = ti_clk_get_reg_addr(node, 1); > + ad->idlest_reg = ti_clk_get_reg_addr(node, 2); > + > + if (!ad->control_reg || !ad->autoidle_reg || !ad->idlest_reg) > + goto cleanup; > + > + clk = clk_register(NULL, &clk_hw->hw); > + if (!IS_ERR(clk)) { > + of_clk_add_provider(node, of_clk_src_simple_get, clk); > + kfree(init); > + return; > + } > +cleanup: > + kfree(clk_hw); > + kfree(init); kfree(ad)? smatch reported (as part of the kernel_patch_verify_report: +drivers/clk/ti/apll.c:400 of_omap2_apll_setup() warn: possible memory leak of 'ad' -- Regards, Nishanth Menon -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html