linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] misc: mic/scif: fix error code in scif_create_remote_lookup()
@ 2015-10-09  6:41 Dan Carpenter
  2015-10-11  9:14 ` Sudeep Dutt
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-09  6:41 UTC (permalink / raw)
  To: Nikhil Rao, Sudeep Dutt
  Cc: Nikhil Rao, Ashutosh Dixit, Greg Kroah-Hartman, linux-kernel,
	kernel-janitors

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>

diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c
index e288996..bc2dccb 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,
 				    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]);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 1/2] misc: mic/scif: fix error code in scif_create_remote_lookup()
  2015-10-09  6:41 [patch 1/2] misc: mic/scif: fix error code in scif_create_remote_lookup() Dan Carpenter
@ 2015-10-11  9:14 ` Sudeep Dutt
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Dutt @ 2015-10-11  9:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sudeep Dutt, Nikhil Rao, Ashutosh Dixit, Greg Kroah-Hartman,
	linux-kernel, kernel-janitors

On Fri, 2015-10-09 at 09:41 +0300, Dan Carpenter wrote:
> We should be returning -ENOMEM here instead of success.
> 

Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>

Thanks for the fix!

> Fixes: ba612aa8b487 ('misc: mic: SCIF memory registration and unregistration')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c
> index e288996..bc2dccb 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,
>  				    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]);



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-11  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-09  6:41 [patch 1/2] misc: mic/scif: fix error code in scif_create_remote_lookup() Dan Carpenter
2015-10-11  9:14 ` Sudeep Dutt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).