From: dillon.minfei at gmail.com <dillon.minfei@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 4/6] ram: stm32: fix strsep failed on read only memory
Date: Fri, 26 Mar 2021 18:24:25 +0800 [thread overview]
Message-ID: <1616754267-13845-5-git-send-email-dillon.minfei@gmail.com> (raw)
In-Reply-To: <1616754267-13845-1-git-send-email-dillon.minfei@gmail.com>
From: dillon min <dillon.minfei@gmail.com>
strsep will change data from original memory address,
in case the memory is in non-sdram/sram place, will
run into a bug(hang at SDRAM: )
just add a temporary array to store bank_name[] to fix this
bug.
Fixes: f303aaf ("ram: stm32: add second SDRAM bank management")
Signed-off-by: dillon min <dillon.minfei@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
---
v2: no changes
drivers/ram/stm32_sdram.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 540ad85..da27677 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -268,6 +268,7 @@ static int stm32_fmc_of_to_plat(struct udevice *dev)
u32 swp_fmc;
ofnode bank_node;
char *bank_name;
+ char _bank_name[128] = {0};
u8 bank = 0;
int ret;
@@ -300,6 +301,8 @@ static int stm32_fmc_of_to_plat(struct udevice *dev)
dev_for_each_subnode(bank_node, dev) {
/* extract the bank index from DT */
bank_name = (char *)ofnode_get_name(bank_node);
+ strcpy(_bank_name, bank_name);
+ bank_name = _bank_name;
strsep(&bank_name, "@");
if (!bank_name) {
pr_err("missing sdram bank index");
--
2.7.4
next prev parent reply other threads:[~2021-03-26 10:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 10:24 [PATCH v2 0/6] Add rt-thread art-pi board support dillon.minfei at gmail.com
2021-03-26 10:24 ` [PATCH v2 1/6] ARM: dts: stm32: split sdram pin & timing parameter into specific board dts dillon.minfei at gmail.com
2021-03-26 10:24 ` [PATCH v2 2/6] ARM: dts: stm32: Add RT-Thread art-pi board support dillon.minfei at gmail.com
2021-03-26 14:24 ` Patrice CHOTARD
2021-03-27 5:10 ` dillon min
2021-03-26 10:24 ` [PATCH v2 3/6] board: Add rt-thread " dillon.minfei at gmail.com
2021-03-26 10:24 ` dillon.minfei at gmail.com [this message]
2021-03-26 10:24 ` [PATCH v2 5/6] dt-bindings: pinctrl: stm32: Add st, stm32h750-pinctrl for stm32h750 soc dillon.minfei at gmail.com
2021-03-26 10:24 ` [PATCH v2 6/6] pinctrl: stm32: Add st, stm32h750-pinctrl compatible string dillon.minfei at gmail.com
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=1616754267-13845-5-git-send-email-dillon.minfei@gmail.com \
--to=dillon.minfei@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox