public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Govindarajulu Varadarajan <gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
To: leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	benve-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org
Cc: Govindarajulu Varadarajan
	<gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH v2 2/2] usnic: do not ignore return value of __ethtool_get_link_ksettings
Date: Thu, 20 Jul 2017 11:23:40 -0700	[thread overview]
Message-ID: <20170720182340.28864-2-gvaradar@cisco.com> (raw)
In-Reply-To: <20170720182340.28864-1-gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>

Do not ignore the return value of the caller.

Signed-off-by: Govindarajulu Varadarajan <gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
---
v2: Do not initialize err as it is over written later

 drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 03002bac93e7..f7be74740b3f 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -327,13 +327,16 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
 {
 	struct usnic_ib_dev *us_ibdev = to_usdev(ibdev);
 	struct ethtool_link_ksettings cmd;
+	int err;
 
 	usnic_dbg("\n");
 
 	mutex_lock(&us_ibdev->usdev_lock);
 	rtnl_lock();
-	__ethtool_get_link_ksettings(us_ibdev->netdev, &cmd);
+	err = __ethtool_get_link_ksettings(us_ibdev->netdev, &cmd);
 	rtnl_unlock();
+	if (err)
+		goto out;
 	/* props being zeroed by the caller, avoid zeroing it here */
 
 	props->lid = 0;
@@ -364,9 +367,10 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
 	/* Userspace will adjust for hdrs */
 	props->max_msg_sz = us_ibdev->ufdev->mtu;
 	props->max_vl_num = 1;
+out:
 	mutex_unlock(&us_ibdev->usdev_lock);
 
-	return 0;
+	return err;
 }
 
 int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
-- 
2.13.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-07-20 18:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 18:23 [PATCH v2 1/2] usnic: add rtnl lock around __ethtool_get_link_ksettings() Govindarajulu Varadarajan
     [not found] ` <20170720182340.28864-1-gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2017-07-20 18:23   ` Govindarajulu Varadarajan [this message]
     [not found]     ` <20170720182340.28864-2-gvaradar-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2017-07-20 19:39       ` [PATCH v2 2/2] usnic: do not ignore return value of __ethtool_get_link_ksettings Yuval Shaia
2017-07-20 19:38   ` [PATCH v2 1/2] usnic: add rtnl lock around __ethtool_get_link_ksettings() Yuval Shaia

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=20170720182340.28864-2-gvaradar@cisco.com \
    --to=gvaradar-fyb4gu1cfyuavxtiumwx3w@public.gmane.org \
    --cc=benve-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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