[PATCH 1/2] cpufreq: sun50i: fix memory leak in dt_has_supported_hw()

Viresh Kumar viresh.kumar at linaro.org
Mon May 20 00:33:39 PDT 2024


On 10-05-24, 17:49, Andre Przywara wrote:
> On Fri, 03 May 2024 19:52:32 +0200
> Javier Carrasco <javier.carrasco.cruz at gmail.com> wrote:
> > diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > index 0b882765cd66..ef83e4bf2639 100644
> > --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > @@ -131,7 +131,7 @@ static const struct of_device_id cpu_opp_match_list[] = {
> >  static bool dt_has_supported_hw(void)
> >  {
> >  	bool has_opp_supported_hw = false;
> > -	struct device_node *np, *opp;
> > +	struct device_node *np;

Why is the opp pointer removed ?

> >  	struct device *cpu_dev;
> >  
> >  	cpu_dev = get_cpu_device(0);
> > @@ -142,7 +142,7 @@ static bool dt_has_supported_hw(void)
> >  	if (!np)
> >  		return false;
> >  
> > -	for_each_child_of_node(np, opp) {
> > +	for_each_child_of_node_scoped(np, opp) {
> >  		if (of_find_property(opp, "opp-supported-hw", NULL)) {
> >  			has_opp_supported_hw = true;
> >  			break;
> > 

-- 
viresh



More information about the linux-arm-kernel mailing list