Skip to contentSkip to conversation

mmc: core: remove uselss memalloc_noio_save

PATCH In review Oliver Neukum 2 participants 3 messages Sep 22, 2025 – Oct 17, 2025 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: remove uselss memalloc_noio_save

mmc_sd_num_wr_blocks() is in the block error path. It needs to use GFP_NOIO. There is no need to complicate anything here.

Fixes 869d37475788 ("mmc: core: Use GFP_NOIO in ACMD22")
---
 drivers/mmc/core/block.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/core/block.c +1 -4
index 9cc47bf94804..766691d27a04 100644
@@ -995,7 +995,6 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
 	u32 result;
 	__be32 *blocks;
 	u8 resp_sz = mmc_card_ult_capacity(card) ? 8 : 4;
-	unsigned int noio_flag;
 
 	struct mmc_request mrq = {};
 	struct mmc_command cmd = {};
@@ -1020,9 +1019,7 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
 	mrq.cmd = &cmd;
 	mrq.data = &data;
 
-	noio_flag = memalloc_noio_save();
-	blocks = kmalloc(resp_sz, GFP_KERNEL);
-	memalloc_noio_restore(noio_flag);
+	blocks = kmalloc(resp_sz, GFP_NOIO);
 	if (!blocks)
 		return -ENOMEM;
 
Signature · 1 line
2.51.0
#1 lore raw
Quoted 6 lines · Oliver Neukum

mmc_sd_num_wr_blocks() is in the block error path. It needs to use GFP_NOIO. There is no need to complicate anything here.

Fixes 869d37475788 ("mmc: core: Use GFP_NOIO in ACMD22")

Is this really something that should be considered as a fix? Is there something broken or we are just cleaning up the code?

Quoted 29 lines
---
 drivers/mmc/core/block.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/core/block.c +1 -5
index 9cc47bf94804..766691d27a04 100644
@@ -995,7 +995,6 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
        u32 result;
        __be32 *blocks;
        u8 resp_sz = mmc_card_ult_capacity(card) ? 8 : 4;
-       unsigned int noio_flag;
 
        struct mmc_request mrq = {};
        struct mmc_command cmd = {};
@@ -1020,9 +1019,7 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
        mrq.cmd = &cmd;
        mrq.data = &data;
 
-       noio_flag = memalloc_noio_save();
-       blocks = kmalloc(resp_sz, GFP_KERNEL);
-       memalloc_noio_restore(noio_flag);
+       blocks = kmalloc(resp_sz, GFP_NOIO);
        if (!blocks)
                return -ENOMEM;
 
--
Quoted 2 lines

2.51.0

Kind regards
Uffe

#2 lore raw
In reply to Oliver Neukum
Quoted 7 lines · Oliver Neukum

mmc_sd_num_wr_blocks() is in the block error path. It needs to use GFP_NOIO. There is no need to complicate anything here.

Fixes 869d37475788 ("mmc: core: Use GFP_NOIO in ACMD22")

Applied for next and I also decided to drop the fixes tag, thanks!

Kind regards
Uffe

Quoted 30 lines
---
 drivers/mmc/core/block.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/mmc/core/block.c +1 -5
index 9cc47bf94804..766691d27a04 100644
@@ -995,7 +995,6 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
        u32 result;
        __be32 *blocks;
        u8 resp_sz = mmc_card_ult_capacity(card) ? 8 : 4;
-       unsigned int noio_flag;
 
        struct mmc_request mrq = {};
        struct mmc_command cmd = {};
@@ -1020,9 +1019,7 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
        mrq.cmd = &cmd;
        mrq.data = &data;
 
-       noio_flag = memalloc_noio_save();
-       blocks = kmalloc(resp_sz, GFP_KERNEL);
-       memalloc_noio_restore(noio_flag);
+       blocks = kmalloc(resp_sz, GFP_NOIO);
        if (!blocks)
                return -ENOMEM;
 
--

2.51.0