Re: [PATCH v5 3/3] PM / AVS: SVS: Introduce SVS engine
From: Pi-Hsun Shih
Date: Mon Oct 21 2019 - 03:52:27 EST
Hi Roger,
On Fri, Sep 6, 2019 at 6:06 PM Roger Lu <roger.lu@xxxxxxxxxxxx> wrote:
> ...
> +static int svs_resource_setup(struct mtk_svs *svs)
> ...
> + for (i = 0, freq = (u32)-1; i < svsb->opp_count; i++, freq--) {
> + opp = dev_pm_opp_find_freq_floor(svsb->dev, &freq);
> + if (IS_ERR(opp)) {
> + pr_err("%s: error opp entry!!, err = %ld\n",
> + svsb->name, PTR_ERR(opp));
> + return PTR_ERR(opp);
> + }
> +
> + svsb->opp_freqs[i] = freq;
> + svsb->opp_volts[i] = dev_pm_opp_get_voltage(opp);
> + svsb->freqs_pct[i] = percent(svsb->opp_freqs[i],
> + svsb->freq_base) & 0xff;
Should have dev_pm_opp_put(opp); here.
> + }
> + }
> +
> + return 0;
> +}
> ...
> +static int svs_status_proc_show(struct seq_file *m, void *v)
> ...
> + for (i = 0, freq = (u32)-1; i < svsb->opp_count; i++, freq--) {
> + opp = dev_pm_opp_find_freq_floor(svsb->dev, &freq);
> + if (IS_ERR(opp)) {
> + seq_printf(m, "%s: error opp entry!!, err = %ld\n",
> + svsb->name, PTR_ERR(opp));
> + return PTR_ERR(opp);
> + }
> +
> + seq_printf(m, "opp_freqs[%02u]: %lu, volts[%02u]: %lu, ",
> + i, freq, i, dev_pm_opp_get_voltage(opp));
> + seq_printf(m, "svsb_volts[%02u]: 0x%x, freqs_pct[%02u]: %u\n",
> + i, svsb->volts[i], i, svsb->freqs_pct[i]);
Same here.
> + }
> +
> + return 0;
> +}
> ...