misc: mic/scif: fix error code in scif_create_remote_lookup()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 9 Oct 2015 06:41:22 +0000 (09:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 Oct 2015 04:49:48 +0000 (21:49 -0700)
We should be returning -ENOMEM here instead of success.

Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/scif/scif_rma.c

index 980ef13b4cf68194e3d9bb8a40134eb8796250ce..8310b4dbff0602ea5f4bd50f3ce87a9e58e854a7 100644 (file)
@@ -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]);