memstick: fixes for mspro_block and ms_block
Subsystems (3)
v2 cover memstick: fixes for mspro_block and ms_block
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/[email protected]/
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
Signature · 1 line
2.56.1
PATCH v2 1/2 memstick: ms_block: keep the power off during a full msb_reset()
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.
--- 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(-)
drivers/memstick/core/ms_block.c +3 -0
@@ -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)
drivers/memstick/core/mspro_block.c +1 -1
@@ -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 );
include/linux/memstick.h +2 -0
@@ -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
Signature · 1 line
2.56.1
PATCH v2 2/2 memstick: ms_block: add the missing newline to the parallel switch error
In reply to Ho Jie FengAllow printk to finalize the record immediately instead of waiting for the next message with a newline.
--- drivers/memstick/core/ms_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/core/ms_block.c +1 -1
@@ -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 ;
Signature · 1 line
2.56.1