mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>,
	ulfh@kernel.org, jh80.chung@samsung.com
Cc: shawn.lin@rock-chips.com, linux-mmc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc-rockchip: Add missing private data for very old controllers
Date: Mon, 25 May 2026 09:44:31 +0800	[thread overview]
Message-ID: <41863f57-3911-48b7-8a6b-11f877b982a8@rock-chips.com> (raw)
In-Reply-To: <20260522184307.2979579-1-heiko@sntech.de>

在 2026/05/23 星期六 2:43, Heiko Stuebner 写道:
> The really old controllers (rk2928, rk3066, rk3188) do not support UHS
> speeds at all, and thus never handled phase data.
> 
> For that reason it never had a parse_dt callback and no driver private
> data at all.
> 
> Commit ff6f0286c896 ("mmc: dw_mmc-rockchip: Add memory clock auto-gating
> support") makes the private data sort of mandatory, because the init
> function checks whether phases are configured internally or through the
> clock controller.
> 
> This results in the old SoCs then experiencing NULL-pointer dereferences
> when they try to access that private-data struct.
> 
> While we could have if (priv) conditionals in all places, it's way less
> cluttery to just give the old types their private-data struct.

Thanks for fixing this.

Acked-by: Shawn Lin <shawn.lin@rock-chips.com>

> 
> Fixes: ff6f0286c896 ("mmc: dw_mmc-rockchip: Add memory clock auto-gating support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>   drivers/mmc/host/dw_mmc-rockchip.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index c6eece4ec3fd..75c82ff20f17 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -441,6 +441,22 @@ static int dw_mci_common_parse_dt(struct dw_mci *host)
>   	return 0;
>   }
>   
> +static int dw_mci_rk2928_parse_dt(struct dw_mci *host)
> +{
> +	struct dw_mci_rockchip_priv_data *priv;
> +	int err;
> +
> +	err = dw_mci_common_parse_dt(host);
> +	if (err)
> +		return err;
> +
> +	priv = host->priv;
> +
> +	priv->internal_phase = false;
> +
> +	return 0;
> +}
> +
>   static int dw_mci_rk3288_parse_dt(struct dw_mci *host)
>   {
>   	struct dw_mci_rockchip_priv_data *priv;
> @@ -514,6 +530,7 @@ static int dw_mci_rockchip_init(struct dw_mci *host)
>   
>   static const struct dw_mci_drv_data rk2928_drv_data = {
>   	.init			= dw_mci_rockchip_init,
> +	.parse_dt		= dw_mci_rk2928_parse_dt,
>   };
>   
>   static const struct dw_mci_drv_data rk3288_drv_data = {


  reply	other threads:[~2026-05-25  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 18:43 Heiko Stuebner
2026-05-25  1:44 ` Shawn Lin [this message]
2026-05-29 14:45 ` Ulf Hansson

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=41863f57-3911-48b7-8a6b-11f877b982a8@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=jh80.chung@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@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®