All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chee, Tien Fong" <tien.fong.chee@altera.com>
To: Chen Huei Lok <chen.huei.lok@altera.com>, u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>, Marek Vasut <marex@denx.de>,
	Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>,
	Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>,
	Boon Khai Ng <boon.khai.ng@altera.com>,
	Kok Kiang Hea <kok.kiang.hea@altera.com>
Subject: Re: [PATCH v4 10/15] ddr: altera: n5x: use correct cast for reset status register read
Date: Wed, 21 Oct 2026 10:24:15 +0800	[thread overview]
Message-ID: <fd49de95-4024-4396-9de7-ff3c22cf0ee6@altera.com> (raw)
In-Reply-To: <20261016044047.21496-11-chen.huei.lok@altera.com>

On 16/10/2026 12:40 pm, Chen Huei Lok wrote:
> From: Tien Fong Chee <tien.fong.chee@altera.com>
>
> Klocwork reported a potential value overflow from an incorrect typecast.
> It cannot actually happen here because the result never exceeds 32 bits,
> but correct the casting of the reset-status register read for the sake of
> good coding practice.
>
> Signed-off-by: Tien Fong Chee <tien.fong.chee@altera.com>
> Signed-off-by: Chen Huei Lok <chen.huei.lok@altera.com>
> ---
>   drivers/ddr/altera/sdram_n5x.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
> index 43d654341cc..d1f0a0d312e 100644
> --- a/drivers/ddr/altera/sdram_n5x.c
> +++ b/drivers/ddr/altera/sdram_n5x.c
> @@ -2869,9 +2869,9 @@ int sdram_mmr_init_full(struct udevice *dev)
>   		 * subsystem in complete reset state before init DDR clock
>   		 * and DDR controller
>   		 */
> -		ret = wait_for_bit_le32((const void *)((uintptr_t)(readl
> +		ret = wait_for_bit_le32((const void *)((uintptr_t)readl
>   					(ddr_handoff_info.mem_reset_base) +
> -					MEM_RST_MGR_STATUS)),
> +					MEM_RST_MGR_STATUS),
>   					MEM_RST_MGR_STATUS_RESET_COMPLETE,
>   					true, TIMEOUT_200MS, false);
>   		if (ret) {
> @@ -2894,8 +2894,8 @@ int sdram_mmr_init_full(struct udevice *dev)
>   
>   		/* Release the controller from reset */
>   		setbits_le32((uintptr_t)
> -			     (readl(ddr_handoff_info.mem_reset_base) +
> -			     MEM_RST_MGR_STATUS), MEM_RST_MGR_STATUS_AXI_RST |
> +			     readl(ddr_handoff_info.mem_reset_base) +
> +			     MEM_RST_MGR_STATUS, MEM_RST_MGR_STATUS_AXI_RST |
>   			     MEM_RST_MGR_STATUS_CONTROLLER_RST |
>   			     MEM_RST_MGR_STATUS_RESET_COMPLETE);
>   


Reviewed-by: Tien Fong Chee <tien.fong.chee@altera.com>

Best regards,
Tien Fong


  parent reply	other threads:[~2026-10-21  2:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261016044047.21496-1-chen.huei.lok@altera.com>
     [not found] ` <20261016044047.21496-2-chen.huei.lok@altera.com>
2026-10-21  1:55   ` [PATCH v4 01/15] misc: fs_loader: Add QSPI RAW offset loading support Chee, Tien Fong
     [not found] ` <20261016044047.21496-3-chen.huei.lok@altera.com>
2026-10-21  2:07   ` [PATCH v4 02/15] arm: dts: socfpga: n5x: add DDR retention calibration backup nodes Chee, Tien Fong
     [not found] ` <20261016044047.21496-4-chen.huei.lok@altera.com>
2026-10-21  2:09   ` [PATCH v4 03/15] arm: socfpga: n5x: enable QSPI mailbox before DDR init Chee, Tien Fong
     [not found] ` <20261016044047.21496-5-chen.huei.lok@altera.com>
2026-10-21  2:14   ` [PATCH v4 04/15] ddr: altera: n5x: Add self-refresh support in DDR4 Chee, Tien Fong
     [not found] ` <20261016044047.21496-6-chen.huei.lok@altera.com>
2026-10-21  2:16   ` [PATCH v4 05/15] configs: socfpga: n5x: enable required configs for DDR retention Chee, Tien Fong
     [not found] ` <20261016044047.21496-7-chen.huei.lok@altera.com>
2026-10-21  2:18   ` [PATCH v4 06/15] ddr: altera: n5x: set DDR init progress bit for watchdog recovery Chee, Tien Fong
     [not found] ` <20261016044047.21496-8-chen.huei.lok@altera.com>
2026-10-21  2:20   ` [PATCH v4 07/15] ddr: altera: n5x: re-init DDR when double-bit ECC error is detected Chee, Tien Fong
     [not found] ` <20261016044047.21496-9-chen.huei.lok@altera.com>
2026-10-21  2:21   ` [PATCH v4 08/15] ddr: altera: n5x: re-init DDR after watchdog reset from init hang Chee, Tien Fong
     [not found] ` <20261016044047.21496-10-chen.huei.lok@altera.com>
2026-10-21  2:22   ` [PATCH v4 09/15] ddr: altera: n5x: return error on invalid DDR controller type Chee, Tien Fong
     [not found] ` <20261016044047.21496-11-chen.huei.lok@altera.com>
2026-10-21  2:24   ` Chee, Tien Fong [this message]
     [not found] ` <20261016044047.21496-12-chen.huei.lok@altera.com>
2026-10-21  2:25   ` [PATCH v4 11/15] ddr: altera: n5x: fix debug log typo Chee, Tien Fong
     [not found] ` <20261016044047.21496-13-chen.huei.lok@altera.com>
2026-10-21  2:27   ` [PATCH v4 12/15] ddr: altera: n5x: rename is_ddr_init_skipped() and quieten reset log Chee, Tien Fong
     [not found] ` <20261016044047.21496-14-chen.huei.lok@altera.com>
2026-10-21  2:29   ` [PATCH v4 13/15] ddr: altera: n5x: drop always-false unsigned less-than-zero checks Chee, Tien Fong
     [not found] ` <20261016044047.21496-15-chen.huei.lok@altera.com>
2026-10-21  2:30   ` [PATCH v4 14/15] ddr: altera: n5x: reconfigure DDR when mem-clk handoff changes Chee, Tien Fong
     [not found] ` <20261016044047.21496-16-chen.huei.lok@altera.com>
2026-10-21  2:31   ` [PATCH v4 15/15] ddr: altera: n5x: Replay PIE handoff on DDR retention restore Chee, Tien Fong

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=fd49de95-4024-4396-9de7-ff3c22cf0ee6@altera.com \
    --to=tien.fong.chee@altera.com \
    --cc=alif.zakuan.yuslaimi@altera.com \
    --cc=boon.khai.ng@altera.com \
    --cc=chen.huei.lok@altera.com \
    --cc=kok.kiang.hea@altera.com \
    --cc=marex@denx.de \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.