Skip to contentSkip to conversation

sr: don't use GFP_DMA in get_capabilities

PATCH In review Christoph Hellwig 2 participants 3 messages Dec 22, 2021 – Dec 28, 2021 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sr: don't use GFP_DMA in get_capabilities

The allocated buffer is used as a command payload, for which the block layer and/or DMA API do the proper bounce buffering if needed.

---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sr.c +1 -1
index 14c122839c409..f925b1f1f9ada 100644
@@ -855,7 +855,7 @@ static void get_capabilities(struct scsi_cd *cd)
 
 
 	/* allocate transfer buffer */
-	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
+	buffer = kmalloc(512, GFP_KERNEL);
 	if (!buffer) {
 		sr_printk(KERN_ERR, cd, "out of memory.\n");
 		return;
Signature · 1 line
2.30.2
#1 lore raw

Sorry, I'll replace this with a v2 also covering the callsites in sr_vendor.c.

#2 lore raw
In reply to Christoph Hellwig
Quoted 14 lines · Christoph Hellwig

The allocated buffer is used as a command payload, for which the block layer and/or DMA API do the proper bounce buffering if needed.

---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sr.c +0 -0
index 14c122839c409..f925b1f1f9ada 100644

drivers/scsi/sr.c static void get_capabilities(struct scsi_cd *cd) · line 860

Quoted 7 lines
drivers/scsi/sr.c +1 -1
@@ -855,7 +855,7 @@ static void get_capabilities(struct scsi_cd *cd)
 
 
 	/* allocate transfer buffer */
-	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
+	buffer = kmalloc(512, GFP_KERNEL);
 	if (!buffer) {
 		sr_printk(KERN_ERR, cd, "out of memory.\n");

A separate trivial cleanup is the unnecessary memory allocation failure message here since the mm layer will already report such things.

-Tyrel

Quoted 2 lines
drivers/scsi/sr.c +0 -0
 		return;