public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: rafael@kernel.org, pavel@ucw.cz, len.brown@intel.com,
	daniel.lezcano@linaro.org, lukasz.luba@arm.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM: EM: Fix uninitialized power in em_create_perf_table
Date: Mon, 4 Nov 2024 09:15:11 +0000	[thread overview]
Message-ID: <ZyiQnz4jbB5ChNxn@google.com> (raw)
In-Reply-To: <20241104090351.1352997-1-ruanjinjie@huawei.com>

Hi,

On Monday 04 Nov 2024 at 17:03:51 (+0800), Jinjie Ruan wrote:
> In em_create_perf_table(), power is uninitialized and passed the pointer
> to active_power() hook, but the hook function may not assign it and
> return 0, such as mtk_cpufreq_get_cpu_power(), so the later zero check for
> power is not invalid, initialize power to zero to fix it.

Sounds to me like a driver bug? We check the return value of
active_power() first, so if the callback failed it should tell us.

mtk_cpufreq_get_cpu_power() should only fail if we couldn't find a
cpufreq policy IIUC, so why can't this return -EINVAL instead?

Thanks,
Quentin

      parent reply	other threads:[~2024-11-04  9:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  9:03 [PATCH] PM: EM: Fix uninitialized power in em_create_perf_table Jinjie Ruan
2024-11-04  9:14 ` Lukasz Luba
2024-11-04  9:16   ` Quentin Perret
2024-11-04  9:19   ` Jinjie Ruan
2024-11-04  9:15 ` Quentin Perret [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyiQnz4jbB5ChNxn@google.com \
    --to=qperret@google.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=ruanjinjie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox