Skip to contentSkip to conversation

Remove naked GFP_DMA from drivers/scsi/sr.c

PATCH New Matthew Wilcox 1 participant 1 message Feb 28, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove naked GFP_DMA from drivers/scsi/sr.c

In get_sectorsize(), we can already sleep in scsi_wait_req(). In get_capabilities(), we can use GFP_KERNEL because it is only called from sr_attach() which already does a GFP_KERNEL allocation.

drivers/scsi/sr.c +4 -5
diff -urpNX dontdiff linux-2.5.63/drivers/scsi/sr.c linux-2.5.63-gfpdma/drivers/scsi/sr.c
@@ -604,7 +604,7 @@ static void get_sectorsize(struct scsi_c
 	struct scsi_request *SRpnt = NULL;
 	request_queue_t *queue;
 
-	buffer = kmalloc(512, GFP_DMA);
+	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
 	if (!buffer)
 		goto Enomem;
 	SRpnt = scsi_allocate_request(cd->device);
@@ -698,7 +698,7 @@ Enomem:
 	goto out;
 }
 
-void get_capabilities(struct scsi_cd *cd)
+static void get_capabilities(struct scsi_cd *cd)
 {
 	struct cdrom_generic_command cgc;
 	unsigned char *buffer;
@@ -716,9 +716,8 @@ void get_capabilities(struct scsi_cd *cd
 		""
 	};
 
-	buffer = kmalloc(512, GFP_DMA);
-	if (!buffer)
-	{
+	buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
+	if (!buffer) {
 		printk(KERN_ERR "sr: out of memory.\n");
 		return;
 	}
Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk