staging: clocking-wizard: Remove use of the kfree function on values allocated using devm_ functions
PATCH 1/1 staging: clocking-wizard: Remove use of the kfree function on values allocated using devm_ functions
Values allocated using the devm_functions are freed when the device is detached and thus the use of the standard freeing function would cause a double free. Hence the patch eliminates kfree function on clk_name.
--- drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +1 -4
@@ -214,7 +214,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) &pdev->dev, clk_name,__clk_get_name (clk_wzrd->clk_in1), 0, reg, 1); -kfree (clk_name); +if (IS_ERR (clk_wzrd->clks_internal[wzrd_clk_mul])) {dev_err (&pdev->dev,"unable to register fixed-factor clock\n" ); ret =PTR_ERR (clk_wzrd->clks_internal[wzrd_clk_mul]);
@@ -268,8 +268,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) } } -kfree (clk_name); - clk_wzrd->clk_data.clks = clk_wzrd->clkout; clk_wzrd->clk_data.clk_num =ARRAY_SIZE (clk_wzrd->clkout);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_wzrd->clk_data);
@@ -294,7 +292,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) err_rm_int_clks:clk_unregister (clk_wzrd->clks_internal[1 ]); err_rm_int_clk: -kfree (clk_name);clk_unregister (clk_wzrd->clks_internal[0 ]); err_disable_clk:clk_disable_unprepare (clk_wzrd->axi_clk);
Signature · 1 line
2.7.4
Quoted 14 lines · sayli karnik
Values allocated using the
devm_functionsare freed when the device is detached and thus the use of the standard freeing function would cause a double free. Hence the patch eliminates kfree function onclk_name.Signed-off-by sayli karnik <[email protected]>--- drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +0
-0
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c static int clk_wzrd_probe(struct platform_device *pdev) · line 217
Quoted 5 lines
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +1
-1@@ -214,7 +214,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) &pdev->dev, clk_name,__clk_get_name (clk_wzrd->clk_in1), 0, reg, 1); -kfree (clk_name); +
I'm confused. Looking a few lines up from this assignment, I see:
clk_name = kasprintf(GFP_KERNEL, "%s_mul", dev_name(&pdev->dev))
There are devm functions for some other things, but not clk_name.
julia
Quoted 30 lines
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +0
-4if (IS_ERR (clk_wzrd->clks_internal[wzrd_clk_mul])) {dev_err (&pdev->dev,"unable to register fixed-factor clock\n" ); ret =PTR_ERR (clk_wzrd->clks_internal[wzrd_clk_mul]);@@ -268,8 +268,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) } } -kfree (clk_name); - clk_wzrd->clk_data.clks = clk_wzrd->clkout; clk_wzrd->clk_data.clk_num =ARRAY_SIZE (clk_wzrd->clkout);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_wzrd->clk_data);@@ -294,7 +292,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) err_rm_int_clks:clk_unregister (clk_wzrd->clks_internal[1 ]); err_rm_int_clk: -kfree (clk_name);clk_unregister (clk_wzrd->clks_internal[0 ]); err_disable_clk:clk_disable_unprepare (clk_wzrd->axi_clk); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160919222610.GA12702%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.
Quoted 26 lines · Julia Lawall
Quoted 14 lines · sayli karnik
Values allocated using the
devm_functionsare freed when the device is detached and thus the use of the standard freeing function would cause a double free. Hence the patch eliminates kfree function onclk_name.Signed-off-by sayli karnik <[email protected]>--- drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +0
-0drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c static int clk_wzrd_probe(struct platform_device *pdev) · line 217
Quoted 5 lines
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +1
-1@@ -214,7 +214,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) &pdev->dev, clk_name,__clk_get_name (clk_wzrd->clk_in1), 0, reg, 1); -kfree (clk_name); +I'm confused. Looking a few lines up from this assignment, I see:
Quoted 2 lines
clk_name=kasprintf(GFP_KERNEL, "%s_mul", dev_name(&pdev->dev))
Oh right, sorry. Mistook kasprintf() for devm_kasprintf().
thanks
sayli
Quoted 34 lines
There are devm functions for some other things, but not
clk_name.julia
Quoted 30 lines
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c +0
-4if (IS_ERR (clk_wzrd->clks_internal[wzrd_clk_mul])) {dev_err (&pdev->dev,"unable to register fixed-factor clock\n" ); ret =PTR_ERR (clk_wzrd->clks_internal[wzrd_clk_mul]);@@ -268,8 +268,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) } } -kfree (clk_name); - clk_wzrd->clk_data.clks = clk_wzrd->clkout; clk_wzrd->clk_data.clk_num =ARRAY_SIZE (clk_wzrd->clkout);of_clk_add_provider (np, of_clk_src_onecell_get, &clk_wzrd->clk_data);@@ -294,7 +292,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) err_rm_int_clks:clk_unregister (clk_wzrd->clks_internal[1 ]); err_rm_int_clk: -kfree (clk_name);clk_unregister (clk_wzrd->clks_internal[0 ]); err_disable_clk:clk_disable_unprepare (clk_wzrd->axi_clk); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160919222610.GA12702%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.