public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Thadeu Lima de Souza Cascardo <cascardo-DmMZpsCg3uxeGPcbtGPokg@public.gmane.org>
To: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Roland Dreier <rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Hal Rosenstock
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Or Gerlitz <ogerlitz-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
	Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch] infiniband:  remove dead code
Date: Mon, 15 Mar 2010 11:18:47 -0300	[thread overview]
Message-ID: <20100315141846.GA1477@holoscopio.com> (raw)
In-Reply-To: <20100315082332.GF18181@bicker>

[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]

On Mon, Mar 15, 2010 at 11:23:32AM +0300, Dan Carpenter wrote:
> "ret" is initialized to -ENOMEM so we don't need to set it here.
> 
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
> index 308d17b..8fa6997 100644
> --- a/drivers/infiniband/ulp/iser/iser_verbs.c
> +++ b/drivers/infiniband/ulp/iser/iser_verbs.c
> @@ -148,10 +148,8 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
>  	device = ib_conn->device;
>  
>  	ib_conn->login_buf = kmalloc(ISER_RX_LOGIN_SIZE, GFP_KERNEL);
> -	if (!ib_conn->login_buf) {
> +	if (!ib_conn->login_buf)
>  		goto alloc_err;
> -		ret = -ENOMEM;
> -	}
>  
>  	ib_conn->login_dma = ib_dma_map_single(ib_conn->device->ib_device,
>  				(void *)ib_conn->login_buf, ISER_RX_LOGIN_SIZE,
> @@ -160,10 +158,9 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
>  	ib_conn->page_vec = kmalloc(sizeof(struct iser_page_vec) +
>  				    (sizeof(u64) * (ISCSI_ISER_SG_TABLESIZE +1)),
>  				    GFP_KERNEL);
> -	if (!ib_conn->page_vec) {
> -		ret = -ENOMEM;
> +	if (!ib_conn->page_vec)
>  		goto alloc_err;
> -	}
> +
>  	ib_conn->page_vec->pages = (u64 *) (ib_conn->page_vec + 1);
>  
>  	params.page_shift        = SHIFT_4K;

If there's a failure while allocating page_vec, login_buf will not be
released. A single extra label should solve this.

Regards,
Cascardo.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2010-03-15 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15  8:23 [patch] infiniband: remove dead code Dan Carpenter
2010-03-15 14:18 ` Thadeu Lima de Souza Cascardo [this message]
     [not found]   ` <20100315141846.GA1477-DmMZpsCg3uxeGPcbtGPokg@public.gmane.org>
2010-03-15 15:07     ` Dan Carpenter
2010-03-16  7:27       ` Or Gerlitz
     [not found]         ` <15ddcffd1003160027q47286fcqa1344c964fe472b0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-16  8:09           ` [patch] infiniband: potential double free Dan Carpenter
2010-04-03 22:34             ` Or Gerlitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100315141846.GA1477@holoscopio.com \
    --to=cascardo-dmmzpscg3uxegpcbtgpokg@public.gmane.org \
    --cc=error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ogerlitz-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    --cc=rolandd-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox