diff options
| author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-10-09 02:41:22 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-18 00:49:48 -0400 |
| commit | e426115e0ad35513d88a3e423b86f839b02f17b5 (patch) | |
| tree | c314ec326b069a4465d98758df922f138bdff900 | |
| parent | ff65212cc4698f532c452a14fdb94a3b1d1f283d (diff) | |
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')
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>
| -rw-r--r-- | drivers/misc/mic/scif/scif_rma.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c index 980ef13b4cf6..8310b4dbff06 100644 --- a/drivers/misc/mic/scif/scif_rma.c +++ b/drivers/misc/mic/scif/scif_rma.c | |||
| @@ -386,16 +386,20 @@ static int scif_create_remote_lookup(struct scif_dev *remote_dev, | |||
| 386 | remote_dev, window->nr_lookup * | 386 | remote_dev, window->nr_lookup * |
| 387 | sizeof(*window->dma_addr_lookup.lookup), | 387 | sizeof(*window->dma_addr_lookup.lookup), |
| 388 | GFP_KERNEL | __GFP_ZERO); | 388 | GFP_KERNEL | __GFP_ZERO); |
| 389 | if (!window->dma_addr_lookup.lookup) | 389 | if (!window->dma_addr_lookup.lookup) { |
| 390 | err = -ENOMEM; | ||
| 390 | goto error_window; | 391 | goto error_window; |
| 392 | } | ||
| 391 | 393 | ||
| 392 | window->num_pages_lookup.lookup = | 394 | window->num_pages_lookup.lookup = |
| 393 | scif_alloc_coherent(&window->num_pages_lookup.offset, | 395 | scif_alloc_coherent(&window->num_pages_lookup.offset, |
| 394 | remote_dev, window->nr_lookup * | 396 | remote_dev, window->nr_lookup * |
| 395 | sizeof(*window->num_pages_lookup.lookup), | 397 | sizeof(*window->num_pages_lookup.lookup), |
| 396 | GFP_KERNEL | __GFP_ZERO); | 398 | GFP_KERNEL | __GFP_ZERO); |
| 397 | if (!window->num_pages_lookup.lookup) | 399 | if (!window->num_pages_lookup.lookup) { |
| 400 | err = -ENOMEM; | ||
| 398 | goto error_window; | 401 | goto error_window; |
| 402 | } | ||
| 399 | 403 | ||
| 400 | vmalloc_dma_phys = is_vmalloc_addr(&window->dma_addr[0]); | 404 | vmalloc_dma_phys = is_vmalloc_addr(&window->dma_addr[0]); |
| 401 | vmalloc_num_pages = is_vmalloc_addr(&window->num_pages[0]); | 405 | vmalloc_num_pages = is_vmalloc_addr(&window->num_pages[0]); |
