From: "Kathpalia, Tanmay" <tanmay.kathpalia@altera.com>
To: Aswin Murugan <aswin.murugan@oss.qualcomm.com>,
casey.connolly@linaro.org, neil.armstrong@linaro.org,
sumit.garg@kernel.org, trini@konsulko.com, peng.fan@nxp.com,
jh80.chung@samsung.com, nathbappai@gmail.com,
quentin.schulz@cherry.de, varadarajan.narayanan@oss.qualcomm.com,
u-boot-qcom@groups.io, u-boot@lists.u-boot-project.org
Subject: Re: [PATCH v1 1/3] mmc: msm_sdhci: fix max-frequency read into wrong-sized variable
Date: Fri, 28 Aug 2026 23:48:55 +0530 [thread overview]
Message-ID: <2e9fb2fa-c875-4bd8-8ef8-472459bfe1b1@altera.com> (raw)
In-Reply-To: <20260827073325.4113071-2-aswin.murugan@oss.qualcomm.com>
Hi Aswin,
On 27-08-2026 13:03, Aswin Murugan wrote:
> msm_sdc_clk_init() reads the "max-frequency" DT property with
> dev_read_u32(dev, "max-frequency", (uint *)(&clk_rate)), writing
> only 4 bytes into clk_rate, an 8-byte ulong. The upper 4 bytes are
> left uninitialized whenever the property is present. Read into a
> u32 local instead, then assign it to clk_rate.
>
> Signed-off-by: Aswin Murugan<aswin.murugan@oss.qualcomm.com>
> ---
> drivers/mmc/msm_sdhci.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
> index 7bdb02142a2..cbf565be426 100644
> --- a/drivers/mmc/msm_sdhci.c
> +++ b/drivers/mmc/msm_sdhci.c
> @@ -65,12 +65,15 @@ static int msm_sdc_clk_init(struct udevice *dev)
> struct msm_sdhc *prv = dev_get_priv(dev);
> const struct msm_sdhc_variant_info *var_info;
> ulong clk_rate;
> + u32 max_frequency;
> int ret, i = 0, n_clks;
> const char *clk_name;
>
> var_info = (void *)dev_get_driver_data(dev);
>
> - if (dev_read_u32(dev, "max-frequency", (uint *)(&clk_rate)))
> + if (!dev_read_u32(node, "max-frequency", &max_frequency))
> + clk_rate = max_frequency;
> + else
> clk_rate = 201500000;
The clean implementation would be:
clk_rate = dev_read_u32_default(dev, "max-frequency", 201500000);
next prev parent reply other threads:[~2026-08-28 18:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 7:33 [PATCH v1 0/3] qcom: Enable HS200/HS400 eMMC modes on Qualcomm platforms Aswin Murugan
2026-08-27 7:33 ` [PATCH v1 1/3] mmc: msm_sdhci: fix max-frequency read into wrong-sized variable Aswin Murugan
2026-08-28 18:18 ` Kathpalia, Tanmay [this message]
2026-08-27 7:33 ` [PATCH v1 2/3] mmc: msm_sdhci: add HS200/HS400 support Aswin Murugan
2026-08-28 19:31 ` Kathpalia, Tanmay
2026-08-27 7:33 ` [PATCH v1 3/3] configs: qcom: enable CONFIG_MMC_HS400_SUPPORT Aswin Murugan
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=2e9fb2fa-c875-4bd8-8ef8-472459bfe1b1@altera.com \
--to=tanmay.kathpalia@altera.com \
--cc=aswin.murugan@oss.qualcomm.com \
--cc=casey.connolly@linaro.org \
--cc=jh80.chung@samsung.com \
--cc=nathbappai@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=peng.fan@nxp.com \
--cc=quentin.schulz@cherry.de \
--cc=sumit.garg@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.u-boot-project.org \
--cc=varadarajan.narayanan@oss.qualcomm.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 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.