From: Maninder Singh <maninder1.s@samsung.com>
To: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
David Miller <davem@davemloft.net>,
"roland@purestorage.com" <roland@purestorage.com>,
Matan Barak <matanb@mellanox.com>,
Moni Shoua <monis@mellanox.com>,
"jackm@dev.mellanox.co.il" <jackm@dev.mellanox.co.il>,
Yishai Hadas <yishaih@mellanox.com>,
"eranbe@mellanox.com" <eranbe@mellanox.com>,
Ira Weiny <ira.weiny@intel.com>,
linux-rdma <linux-rdma@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
PANKAJ MISHRA <pankaj.m@samsung.com>
Subject: Re: [PATCH 1/1] infiniband: Remove redundant NULL check before kfree
Date: Wed, 08 Jul 2015 04:23:34 +0000 (GMT) [thread overview]
Message-ID: <1037392254.437811436329408244.JavaMail.weblogic@ep2mlwas06a> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 992 bytes --]
Hello,
>> + for (i = 0; i < dev->caps.num_ports; i++)
>> + kfree(dm[i]);
>> goto out;
>> }
>> }
>> --
>> 1.7.9.5
>>
>
>If you are going to change this, you might as well make it 100% correct:
>
>i-;
>while (i >= 0)
> kfree(dm[i]);
>
>Then you dont have to worry about whether kfree works on NULL, every item you free will be guaranteed to be non-NULL.
Thanks for suggestion :)
Sent new patch with described changes, I was thinking one more thing.
In below code :-
if (!ibdev->sriov.is_going_down)
queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work);
spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags);
}
out:
kfree(dm);
return;
dm is freed after queue_work, is it correct to free dm when other dm[i] are allocated ? i did not get it.
Thanks
Maninder
------------ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2015-07-08 4:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 4:23 Maninder Singh [this message]
2015-07-08 22:24 ` Doug Ledford
-- strict thread matches above, loose matches on Subject: below --
2015-06-26 7:09 Maninder Singh
2015-07-07 18:53 ` Doug Ledford
2015-07-09 17:06 ` Christoph Lameter
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=1037392254.437811436329408244.JavaMail.weblogic@ep2mlwas06a \
--to=maninder1.s@samsung.com \
--cc=davem@davemloft.net \
--cc=dledford@redhat.com \
--cc=eranbe@mellanox.com \
--cc=ira.weiny@intel.com \
--cc=jackm@dev.mellanox.co.il \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=monis@mellanox.com \
--cc=ogerlitz@mellanox.com \
--cc=pankaj.m@samsung.com \
--cc=roland@purestorage.com \
--cc=sean.hefty@intel.com \
--cc=yishaih@mellanox.com \
/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
Powered by JetHome