mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kalderon, Michal" <Michal.Kalderon@cavium.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Yunsheng Lin <linyunsheng@huawei.com>
Cc: "Elior, Ariel" <Ariel.Elior@cavium.com>,
	Dept-Eng Everest Linux L2 <Dept-EngEverestLinuxL2@cavium.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH net-next] qed: Set error code for allocation failures
Date: Sun, 29 Oct 2017 07:45:23 +0000	[thread overview]
Message-ID: <CY1PR0701MB2012AE5C7622691629FDDB9488580@CY1PR0701MB2012.namprd07.prod.outlook.com> (raw)
In-Reply-To: <20171027115252.hhqc2u6zrn5b4uet@mwanda>

From: Dan Carpenter <dan.carpenter@oracle.com>
Sent: Friday, October 27, 2017 2:52 PM

>On Fri, Oct 27, 2017 at 05:32:42PM +0800, Yunsheng Lin wrote:
>> >     iwarp_info = &p_hwfn->p_rdma_info->iwarp;
>> > @@ -2696,6 +2696,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
>> >     if (rc)
>> >             goto err;
>> >
>> > +   rc = -ENOMEM;
>> >     iwarp_info->partial_fpdus = kcalloc((u16)p_hwfn->p_rdma_info->num_qps,
>> >                                         sizeof(*iwarp_info->partial_fpdus),
>> >                                         GFP_KERNEL);
>>
>> Does the memory allocated here need to be freed when error happens below?
>>
>
>Hm...  I think you're right that it leaks.  Also I'm confused by the
>qed_iwarp_ll2_alloc_buffers() allocation.  The comment in there says
>that /* buffers will be deallocated by qed_ll2 */ but qed_ll2 is not
>a function name or something which is useful to grep.

Thanks Dan, partial_fpdus is released during qed_iwarp_resc_free, called from qed_rdma_resc_free
called on qed_rdma_stop and on failure during qed_rdma_start.
Regarding ll2 buffers. For each successfully allocated buffer we call
qed_iwarp_ll2_post_rx->qed_ll2_post_rx_buffer.
These buffers will get released and freed when we call qed_ll2_terminate_connection
called from qed_iwarp_ll2_stop ( which is called during qed_iwarp_ll2_start on error ).
thanks,
Michal 

  parent reply	other threads:[~2017-10-29  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27  6:40 Dan Carpenter
2017-10-27  9:32 ` Yunsheng Lin
2017-10-27 11:52   ` Dan Carpenter
2017-10-28  5:50     ` Yunsheng Lin
2017-10-29  7:45     ` Kalderon, Michal [this message]
2017-10-29  7:50 ` Kalderon, Michal

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=CY1PR0701MB2012AE5C7622691629FDDB9488580@CY1PR0701MB2012.namprd07.prod.outlook.com \
    --to=michal.kalderon@cavium.com \
    --cc=Ariel.Elior@cavium.com \
    --cc=Dept-EngEverestLinuxL2@cavium.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.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

all inboxes | Powered by JetHome®