RE: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> Sent: Wednesday, May 16, 2018 17:12
> To: Amit Kucheria <amit.kucheria@xxxxxxxxxx>
> Cc: Ilia Lin <ilialin@xxxxxxxxxxxxxx>; Michael Turquette
> <mturquette@xxxxxxxxxxxx>; sboyd@xxxxxxxxxx; Rob Herring
> <robh@xxxxxxxxxx>; Mark Rutland <mark.rutland@xxxxxxx>; nm@xxxxxx;
> lgirdwood@xxxxxxxxx; broonie@xxxxxxxxxx; Andy Gross
> <andy.gross@xxxxxxxxxx>; David Brown <david.brown@xxxxxxxxxx>;
> catalin.marinas@xxxxxxx; will.deacon@xxxxxxx; Rafael J. Wysocki
> <rjw@xxxxxxxxxxxxx>; linux-clk@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; LKML <linux-kernel@xxxxxxxxxxxxxxx>; Linux
> PM list <linux-pm@xxxxxxxxxxxxxxx>; linux-arm-msm@xxxxxxxxxxxxxxx; linux-
> soc@xxxxxxxxxxxxxxx; lakml <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>;
> Rajendra Nayak <rnayak@xxxxxxxxxxxxxx>; nicolas.dechesne@xxxxxxxxxx;
> celster@xxxxxxxxxxxxxx; tfinkel@xxxxxxxxxxxxxx
> Subject: Re: [PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver
> 
> On 16-05-18, 16:12, Amit Kucheria wrote:
> > > +       ret = PTR_ERR_OR_ZERO(opp_temp =
> > > +
> dev_pm_opp_set_supported_hw(cpu_dev,&versions,1));
> > > +       if (0 > ret)
> >
> > Any particular reason to prefer this over (ret < 0) that is generally
> > used? I've seen it used to avoid the == vs. = typos, but not for other
> > comparisons.
> >
> > Suggest sticking to what is commonly used i.e. ret < 0.
> >
> > > +               goto free_opp;
> > > +
> > > +       cpu_dev = get_cpu_device(GOLD_LEAD);
> >
> > Error check cpu_dev here?
> >
> > > +       ret = PTR_ERR_OR_ZERO(opp_temp =
> > > +
> dev_pm_opp_set_supported_hw(cpu_dev,&versions,1));
> > > +       if (0 > ret)
> > > +               goto free_opp;
> 
> The goto here is wrong

If we are here, then the first dev_pm_opp_set_supported_hw() succeeded. And
should be deallocated before exit with error.

> 
> > > +
> > > +
> > > +       ret =
> PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt",
> > > +                                                             -1,
> > > + NULL, 0));
> > > +
> > > +       if (0 == ret)
> > > +               return 0;
> > > +
> > > +free_opp:
> > > +       dev_pm_opp_put_supported_hw(opp_temp);
> >
> > This is not needed because dev_pm_opp_set_supported_hw will free
> > memory in case of failure. This call in only needed in case of a
> > successful get.
> 
> But this is still required for the case where platform device registration
fails.
> 
> --
> viresh

--
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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux