mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Insu Yun <wuninsu@gmail.com>
To: umalhi@cisco.com, dledford@redhat.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,
	Insu Yun <wuninsu@gmail.com>
Subject: [PATCH] usnic: corretly check failed allocation
Date: Thu, 15 Oct 2015 12:27:40 -0400	[thread overview]
Message-ID: <1444926460-29333-1-git-send-email-wuninsu@gmail.com> (raw)

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>
---
 drivers/infiniband/hw/usnic/usnic_ib_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 34c49b8..7c5f602 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -328,14 +328,14 @@ 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);
 	}
 
 	us_ibdev->ufdev = usnic_fwd_dev_alloc(dev);
-	if (IS_ERR_OR_NULL(us_ibdev->ufdev)) {
+	if (!us_ibdev->ufdev) {
 		usnic_err("Failed to alloc ufdev for %s with err %ld\n",
 				pci_name(dev), PTR_ERR(us_ibdev->ufdev));
 		goto err_dealloc;
-- 
1.9.1


             reply	other threads:[~2015-10-15 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 16:27 Insu Yun [this message]
2015-10-15 17:17 ` Dave Goodell (dgoodell)
     [not found]   ` <CAGoFzNdD+b1co+6zsEo94KP3APLk353fwOQkgdMjh01UOG-9Ng@mail.gmail.com>
2015-10-15 20:52     ` Dave Goodell

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=1444926460-29333-1-git-send-email-wuninsu@gmail.com \
    --to=wuninsu@gmail.com \
    --cc=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=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

all inboxes | Powered by JetHome®