[PATCH v7 12/14] cpufreq: Add Kryo CPU scaling driver
ilialin at codeaurora.org
ilialin at codeaurora.org
Thu May 17 00:50:34 PDT 2018
> -----Original Message-----
> From: Viresh Kumar <viresh.kumar at linaro.org>
> Sent: Wednesday, May 16, 2018 17:12
> To: Amit Kucheria <amit.kucheria at linaro.org>
> Cc: Ilia Lin <ilialin at codeaurora.org>; Michael Turquette
> <mturquette at baylibre.com>; sboyd at kernel.org; Rob Herring
> <robh at kernel.org>; Mark Rutland <mark.rutland at arm.com>; nm at ti.com;
> lgirdwood at gmail.com; broonie at kernel.org; Andy Gross
> <andy.gross at linaro.org>; David Brown <david.brown at linaro.org>;
> catalin.marinas at arm.com; will.deacon at arm.com; Rafael J. Wysocki
> <rjw at rjwysocki.net>; linux-clk at vger.kernel.org;
> devicetree at vger.kernel.org; LKML <linux-kernel at vger.kernel.org>; Linux
> PM list <linux-pm at vger.kernel.org>; linux-arm-msm at vger.kernel.org; linux-
> soc at vger.kernel.org; lakml <linux-arm-kernel at lists.infradead.org>;
> Rajendra Nayak <rnayak at codeaurora.org>; nicolas.dechesne at linaro.org;
> celster at codeaurora.org; tfinkel at codeaurora.org
> 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
More information about the linux-arm-kernel
mailing list