mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Ojha <quic_mojha@quicinc.com>
To: Nikita Kiryushin <kiryushin@ancud.ru>, Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Sebastian Reichel <sre@kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Pramod Gurav <pramod.gurav@smartplayin.com>,
	Guenter Roeck <linux@roeck-us.net>,
	<linux-arm-msm@vger.kernel.org>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org>
Subject: Re: [PATCH] power: reset: msm: Process register_restart_handler() error
Date: Sat, 16 Dec 2023 13:45:14 +0530	[thread overview]
Message-ID: <89ca6eb2-9a33-c37e-14ae-6181edb8626c@quicinc.com> (raw)
In-Reply-To: <feeb1a89-59bd-4fd6-81a5-1d828f95b0f0@ancud.ru>



On 11/8/2023 10:57 PM, Nikita Kiryushin wrote:
> If registering restart handler fails for msm-restart result is not checked.
> It may be irrelevant now (as stated in comment to register_restart_handler,
> the function currently always returns zero), but if the behavior changes
> in the future, an error at registration of handler will be silently 
> skipped.
> 
> Add return error code and print error message too debug log in case of
> non-zero result of register_restart_handler.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 18a702e0de98 ("power: reset: use restart_notifier mechanism for 
> msm-poweroff")
> 
> Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
> ---
>   drivers/power/reset/msm-poweroff.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/reset/msm-poweroff.c 
> b/drivers/power/reset/msm-poweroff.c
> index b9a401bd280b..5877a1ba2778 100644
> --- a/drivers/power/reset/msm-poweroff.c
> +++ b/drivers/power/reset/msm-poweroff.c
> @@ -35,11 +35,16 @@ static void do_msm_poweroff(void)
>    static int msm_restart_probe(struct platform_device *pdev)
>   {
> +    int ret = -EINVAL;

This does not add up anything., no need to initialize.

-Mukesh


>       msm_ps_hold = devm_platform_ioremap_resource(pdev, 0);
>       if (IS_ERR(msm_ps_hold))
>           return PTR_ERR(msm_ps_hold);
>   -    register_restart_handler(&restart_nb);
> +    ret = register_restart_handler(&restart_nb);
> +    if (ret) {
> +        dev_err(&pdev->dev, "unable to register restart handler, %d\n", 
> ret);
> +        return ret;
> +    }
>        pm_power_off = do_msm_poweroff;
>   -- 2.34.1
> 

  parent reply	other threads:[~2023-12-16  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 17:27 Nikita Kiryushin
2023-11-15 22:24 ` Sebastian Reichel
2023-12-16  8:15 ` Mukesh Ojha [this message]
2023-12-16 15:50   ` Guenter Roeck

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=89ca6eb2-9a33-c37e-14ae-6181edb8626c@quicinc.com \
    --to=quic_mojha@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=kiryushin@ancud.ru \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lvc-project@linuxtesting.org \
    --cc=pramod.gurav@smartplayin.com \
    --cc=sboyd@codeaurora.org \
    --cc=sre@kernel.org \
    /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

all inboxes | Powered by JetHome®