From: Doug Ledford <dledford@redhat.com>
To: Insu Yun <wuninsu@gmail.com>,
umalhi@cisco.com, sean.hefty@intel.com, hal.rosenstock@gmail.com,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu
Subject: Re: [PATCH] usnic: correctly check failed allocation
Date: Wed, 21 Oct 2015 16:43:39 -0400 [thread overview]
Message-ID: <5627F8FB.5050102@redhat.com> (raw)
In-Reply-To: <1444943715-31250-1-git-send-email-wuninsu@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]
On 10/15/2015 05:15 PM, Insu Yun wrote:
> Since ib_alloc_device returns allocated memory address, not error,
> it should be checked as IS_NULL, not IS_ERR_OR_NULL.
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
Thanks, applied.
> ---
> drivers/infiniband/hw/usnic/usnic_ib_main.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> index 34c49b8..cbc0514 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> @@ -328,16 +328,15 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
> netdev = pci_get_drvdata(dev);
>
> us_ibdev = (struct usnic_ib_dev *)ib_alloc_device(sizeof(*us_ibdev));
> - if (IS_ERR_OR_NULL(us_ibdev)) {
> + if (!us_ibdev) {
> usnic_err("Device %s context alloc failed\n",
> netdev_name(pci_get_drvdata(dev)));
> - return ERR_PTR(us_ibdev ? PTR_ERR(us_ibdev) : -EFAULT);
> + return ERR_PTR(-EFAULT);
> }
>
> us_ibdev->ufdev = usnic_fwd_dev_alloc(dev);
> - if (IS_ERR_OR_NULL(us_ibdev->ufdev)) {
> - usnic_err("Failed to alloc ufdev for %s with err %ld\n",
> - pci_name(dev), PTR_ERR(us_ibdev->ufdev));
> + if (!us_ibdev->ufdev) {
> + usnic_err("Failed to alloc ufdev for %s\n", pci_name(dev));
> goto err_dealloc;
> }
>
>
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
prev parent reply other threads:[~2015-10-21 20:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 21:15 [PATCH] usnic: correctly check failed allocation Insu Yun
2015-10-15 21:34 ` Dave Goodell
2015-10-21 20:43 ` Doug Ledford [this message]
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=5627F8FB.5050102@redhat.com \
--to=dledford@redhat.com \
--cc=hal.rosenstock@gmail.com \
--cc=insu@gatech.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.com \
--cc=taesoo@gatech.edu \
--cc=umalhi@cisco.com \
--cc=wuninsu@gmail.com \
--cc=yeongjin.jang@gatech.edu \
/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;
as well as URLs for NNTP newsgroup(s).