All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <pengpeng@iscas.ac.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: analogix: Propagate PHY errors from resume
Date: Fri, 28 Aug 2026 09:26:24 +0000	[thread overview]
Message-ID: <20260828092624.9054B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828091334.5793-1-pengpeng@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The return value of the platform-specific dp->plat_data->power_on() callback is ignored in analogix_dp_resume(), potentially leading to hardware faults and unbalanced clock disables in the newly added error path.
--

commit 777e12c640d41a75f043282a8ce210a68d6eca97
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>

drm/bridge: analogix: Propagate PHY errors from resume

This patch updates analogix_dp_resume() to check the return values of
phy_set_mode() and phy_power_on(). If either fails, it rolls back the power
configuration using a newly added power_off error path instead of ignoring
the error.

> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 30c0c0b41d5aa..00844f68d748e 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -1461,12 +1461,23 @@ int analogix_dp_resume(struct analogix_dp_device *dp)
>  	if (dp->plat_data->power_on)
>  		dp->plat_data->power_on(dp->plat_data);
>  

[Severity: High]
This isn't a bug introduced by this patch, but should the return value of
dp->plat_data->power_on() be checked here?

If dp->plat_data->power_on() fails (for example, if clk_prepare_enable()
fails in rockchip_dp_poweron()), it returns a negative error code and
leaves the platform clock disabled. By ignoring this error, execution
proceeds to phy_set_mode() and analogix_dp_init_dp(), which can result in
accessing unpowered hardware registers. Accessing unpowered hardware
typically causes a synchronous external abort on Arm platforms.

Furthermore, this patch actively exacerbates this issue. If the platform
power initialization fails and subsequently phy_set_mode() or
phy_power_on() fails, the newly added goto power_off error path will
execute:

    power_off:
        if (dp->plat_data->power_off)
            dp->plat_data->power_off(dp->plat_data);
        clk_disable_unprepare(dp->clock);

Can this cause an unbalanced clock disable? The power_off path will blindly
call clk_disable_unprepare() on the platform clock that was never
successfully enabled.

> -	phy_set_mode(dp->phy, PHY_MODE_DP);
> -	phy_power_on(dp->phy);
> +	ret = phy_set_mode(dp->phy, PHY_MODE_DP);
> +	if (ret)
> +		goto power_off;
> +
> +	ret = phy_power_on(dp->phy);
> +	if (ret)
> +		goto power_off;
>  
>  	analogix_dp_init_dp(dp);
>  
>  	return 0;
> +
> +power_off:
> +	if (dp->plat_data->power_off)
> +		dp->plat_data->power_off(dp->plat_data);
> +	clk_disable_unprepare(dp->clock);
> +	return ret;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828091334.5793-1-pengpeng@iscas.ac.cn?part=1

      reply	other threads:[~2026-08-28  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  9:13 [PATCH] drm/bridge: analogix: Propagate PHY errors from resume Pengpeng Hou
2026-08-28  9:26 ` sashiko-bot [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=20260828092624.9054B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=pengpeng@iscas.ac.cn \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.