* [PATCH v2 0/2] memstick: fixes for mspro_block and ms_block
@ 2026-12-03 16:42 Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset() Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 2/2] memstick: ms_block: add the missing newline to the parallel switch error Ho Jie Feng
0 siblings, 2 replies; 3+ messages in thread
From: Ho Jie Feng @ 2026-12-03 16:42 UTC (permalink / raw)
To: Ulf Hansson
Cc: Maxim Levitsky, Alex Dubov, linux-mmc, linux-kernel, Ho Jie Feng
This series fixes bugs that I found in the memstick core while writing
the bcm577x5_ms host driver for the Broadcom BCM57765/57785 card reader.
Some of these bugs were really rare, so I used Claude to automatically
fuzz access patterns/events to reproduce some of these issues.
Changelog v2:
- Remove patches 1-3 since they are merged
- Add cc: stable
- Make the power off delay a #define and unify with mspro_block
Link to v1: https://lore.kernel.org/linux-mmc/20261109153510.7161-1-hjf3108@gmail.com/
Ho Jie Feng (2):
memstick: ms_block: keep the power off during a full msb_reset()
memstick: ms_block: add the missing newline to the parallel switch
error
drivers/memstick/core/ms_block.c | 5 ++++-
drivers/memstick/core/mspro_block.c | 2 +-
include/linux/memstick.h | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
base-commit: 428260df6b8740cfbcbd83c6279109c996366d08
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset()
2026-12-03 16:42 [PATCH v2 0/2] memstick: fixes for mspro_block and ms_block Ho Jie Feng
@ 2026-12-03 16:42 ` Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 2/2] memstick: ms_block: add the missing newline to the parallel switch error Ho Jie Feng
1 sibling, 0 replies; 3+ messages in thread
From: Ho Jie Feng @ 2026-12-03 16:42 UTC (permalink / raw)
To: Ulf Hansson
Cc: Maxim Levitsky, Alex Dubov, linux-mmc, linux-kernel, Ho Jie Feng,
stable, Thomas Fourier, Maoyi Xie, Guangshuo Li, Hemanth Selam,
Andrew Morton
Keep the power off for long enough so that the card properly
power cycles.
mspro_block already waits 10 ms when it power cycles the card to fall
back to serial mode. Move that delay to a define in memstick.h and use
it in both drivers.
Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
Cc: stable@vger.kernel.org
Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
---
drivers/memstick/core/ms_block.c | 3 +++
drivers/memstick/core/mspro_block.c | 2 +-
include/linux/memstick.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index 151dffb636c1e..d3cae3a40dca2 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -740,6 +740,9 @@ static int msb_reset(struct msb_data *msb, bool full)
msb_invalidate_reg_window(msb);
+ /* Allow enough time for the card to fully power off */
+ msleep(MEMSTICK_POWER_OFF_DELAY_MS);
+
error = host->set_param(host,
MEMSTICK_POWER, MEMSTICK_POWER_ON);
if (error)
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 215f4c3759c41..7da1ca4c2268f 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -867,7 +867,7 @@ static int mspro_block_switch_interface(struct memstick_dev *card)
dev_name(&card->dev));
msb->system = MEMSTICK_SYS_SERIAL;
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
- msleep(10);
+ msleep(MEMSTICK_POWER_OFF_DELAY_MS);
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON);
host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL);
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 107bdcbedf794..cec27e2372758 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -202,6 +202,8 @@ enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
#define MEMSTICK_POWER_OFF 0
#define MEMSTICK_POWER_ON 1
+#define MEMSTICK_POWER_OFF_DELAY_MS 10
+
#define MEMSTICK_SERIAL 0
#define MEMSTICK_PAR4 1
#define MEMSTICK_PAR8 2
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] memstick: ms_block: add the missing newline to the parallel switch error
2026-12-03 16:42 [PATCH v2 0/2] memstick: fixes for mspro_block and ms_block Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset() Ho Jie Feng
@ 2026-12-03 16:42 ` Ho Jie Feng
1 sibling, 0 replies; 3+ messages in thread
From: Ho Jie Feng @ 2026-12-03 16:42 UTC (permalink / raw)
To: Ulf Hansson
Cc: Maxim Levitsky, Alex Dubov, linux-mmc, linux-kernel, Ho Jie Feng,
stable, Hemanth Selam, Thomas Fourier, Guangshuo Li,
Andrew Morton
Allow printk to finalize the record immediately instead of waiting
for the next message with a newline.
Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
Cc: stable@vger.kernel.org
Signed-off-by: Ho Jie Feng <hjf3108@gmail.com>
---
drivers/memstick/core/ms_block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index d3cae3a40dca2..1ef0811de0d9d 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -778,7 +778,7 @@ static int msb_switch_to_parallel(struct msb_data *msb)
error = msb_run_state_machine(msb, h_msb_parallel_switch);
if (error) {
- pr_err("Switch to parallel failed");
+ pr_err("Switch to parallel failed\n");
msb->regs.param.system &= ~MEMSTICK_SYS_PAM;
msb_reset(msb, true);
return -EFAULT;
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-03 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 16:42 [PATCH v2 0/2] memstick: fixes for mspro_block and ms_block Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 1/2] memstick: ms_block: keep the power off during a full msb_reset() Ho Jie Feng
2026-12-03 16:42 ` [PATCH v2 2/2] memstick: ms_block: add the missing newline to the parallel switch error Ho Jie Feng
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®