mfd: syscon: Free the allocated name field of struct regmap_config
[linux-2.6-microblaze.git] / drivers / mfd / syscon.c
index c6f139b..765c021 100644 (file)
@@ -108,6 +108,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
        syscon_config.max_register = resource_size(&res) - reg_io_width;
 
        regmap = regmap_init_mmio(NULL, base, &syscon_config);
+       kfree(syscon_config.name);
        if (IS_ERR(regmap)) {
                pr_err("regmap init failed\n");
                ret = PTR_ERR(regmap);
@@ -144,7 +145,6 @@ err_clk:
        regmap_exit(regmap);
 err_regmap:
        iounmap(base);
-       kfree(syscon_config.name);
 err_map:
        kfree(syscon);
        return ERR_PTR(ret);