Skip to contentSkip to conversation

misc: mic/scif: fix error code in scif_create_remote_lookup()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 9, 2015 – Oct 11, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 misc: mic/scif: fix error code in scif_create_remote_lookup()

We should be returning -ENOMEM here instead of success.

Fixes ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
drivers/misc/mic/scif/scif_rma.c +6 -2
index e288996..bc2dccb 100644
@@ -386,16 +386,20 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev,
 				    remote_dev, window->nr_lookup *
 				    sizeof(*window->dma_addr_lookup.lookup),
 				    GFP_KERNEL | __GFP_ZERO);
-	if (!window->dma_addr_lookup.lookup)
+	if (!window->dma_addr_lookup.lookup) {
+		err = -ENOMEM;
 		goto error_window;
+	}
 
 	window->num_pages_lookup.lookup  		scif_alloc_coherent(&window->num_pages_lookup.offset,
 				    remote_dev, window->nr_lookup *
 				    sizeof(*window->num_pages_lookup.lookup),
 				    GFP_KERNEL | __GFP_ZERO);
-	if (!window->num_pages_lookup.lookup)
+	if (!window->num_pages_lookup.lookup) {
+		err = -ENOMEM;
 		goto error_window;
+	}
 
 	vmalloc_dma_phys = is_vmalloc_addr(&window->dma_addr[0]);
 	vmalloc_num_pages = is_vmalloc_addr(&window->num_pages[0]);
Reviewed-by on v1 1/2
#1 lore raw
Quoted 2 lines · Dan Carpenter

We should be returning -ENOMEM here instead of success.

Thanks for the fix!

Quoted 29 lines
Fixes ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
drivers/misc/mic/scif/scif_rma.c +6 -2
index e288996..bc2dccb 100644
@@ -386,16 +386,20 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev,
 				    remote_dev, window->nr_lookup *
 				    sizeof(*window->dma_addr_lookup.lookup),
 				    GFP_KERNEL | __GFP_ZERO);
-	if (!window->dma_addr_lookup.lookup)
+	if (!window->dma_addr_lookup.lookup) {
+		err = -ENOMEM;
 		goto error_window;
+	}
 
 	window->num_pages_lookup.lookup >  		scif_alloc_coherent(&window->num_pages_lookup.offset,
 				    remote_dev, window->nr_lookup *
 				    sizeof(*window->num_pages_lookup.lookup),
 				    GFP_KERNEL | __GFP_ZERO);
-	if (!window->num_pages_lookup.lookup)
+	if (!window->num_pages_lookup.lookup) {
+		err = -ENOMEM;
 		goto error_window;
+	}
 
 	vmalloc_dma_phys = is_vmalloc_addr(&window->dma_addr[0]);
 	vmalloc_num_pages = is_vmalloc_addr(&window->num_pages[0]);