Skip to contentSkip to conversation

Fix warnings reported by kbuild

PATCH Applied Leon Romanovsky 2 participants 4 messages Jul 20, 2020 – Jul 24, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

cover Fix warnings reported by kbuild

From: Leon Romanovsky <[email protected]>

Changelog
v1:
* Delete "pd" cleanup line
* Moved all cleaned feilds to be last in declaration list to improve readability.
v0:
https://lore.kernel.org/lkml/[email protected]
------------------------------------------------------------------
Hi,

There are two change as were reported by kbuild. They are not important enough to have Fixes line.

Thanks

Leon Romanovsky (2):
RDMA/uverbs: Remove redundant assignments RDMA/uverbs: Silence shiftTooManyBitsSigned warning

 drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--
2.26.2

#1 lore raw

PATCH 1/2 RDMA/uverbs: Remove redundant assignments

From: Leon Romanovsky <[email protected]>

The kbuild reported the following warning, so clean whole uverbs_cmd.c file.

drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
is reassigned a value before the old one has
been used. [redundantAssignment]

    ret = uverbs_request(attrs, &cmd, sizeof(cmd));
        ^
   drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
reassigned a value before the old one has been
used.
    int    ret = -EINVAL;

^

---
 drivers/infiniband/core/uverbs_cmd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +5 -5
index a66fc3e37a74..c36f22ab9bae 100644
@@ -558,11 +558,11 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_open_xrcd	cmd;
 	struct ib_uxrcd_object         *obj;
 	struct ib_xrcd                 *xrcd = NULL;
-	struct fd			f = {NULL, 0};
 	struct inode                   *inode = NULL;
-	int				ret = 0;
 	int				new_xrcd = 0;
 	struct ib_device *ib_dev;
+	struct fd f = {};
+	int ret;
 
 	ret = uverbs_request(attrs, &cmd, sizeof(cmd));
 	if (ret)
@@ -1059,7 +1059,7 @@ static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_resize_cq	cmd;
 	struct ib_uverbs_resize_cq_resp	resp = {};
 	struct ib_cq			*cq;
-	int				ret = -EINVAL;
+	int ret;
 
 	ret = uverbs_request(attrs, &cmd, sizeof(cmd));
 	if (ret)
@@ -1504,10 +1504,10 @@ static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs)
 	struct ib_uverbs_open_qp        cmd;
 	struct ib_uqp_object           *obj;
 	struct ib_xrcd		       *xrcd;
-	struct ib_uobject	       *uninitialized_var(xrcd_uobj);
 	struct ib_qp                   *qp;
 	struct ib_qp_open_attr          attr = {};
 	int ret;
+	struct ib_uobject *xrcd_uobj;
 	struct ib_device *ib_dev;
 
 	ret = uverbs_request(attrs, &cmd, sizeof(cmd));
@@ -3286,9 +3286,9 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
 	struct ib_usrq_object           *obj;
 	struct ib_pd                    *pd;
 	struct ib_srq                   *srq;
-	struct ib_uobject               *uninitialized_var(xrcd_uobj);
 	struct ib_srq_init_attr          attr;
 	int ret;
+	struct ib_uobject *xrcd_uobj;
 	struct ib_device *ib_dev;
 
 	obj = (struct ib_usrq_object *)uobj_alloc(UVERBS_OBJECT_SRQ, attrs,
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/2 RDMA/uverbs: Silence shiftTooManyBitsSigned warning

In reply to Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Fix reported by kbuild warning.

drivers/infiniband/core/uverbs_cmd.c:1897:47: warning: Shifting
signed 32-bit value by 31 bits is undefined
behaviour [shiftTooManyBitsSigned]

    BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1 << 31));
                                                 ^
---
 drivers/infiniband/core/uverbs_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +1 -1
index c36f22ab9bae..896e2cc046b0 100644
@@ -1892,7 +1892,7 @@ static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
 	 * Last bit is reserved for extending the attr_mask by
 	 * using another field.
 	 */
-	BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1 << 31));
+	BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1ULL << 31));
 
 	if (cmd.base.attr_mask &
 	    ~((IB_USER_LAST_QP_ATTR_MASK << 1) - 1))
Signature · 1 line
2.26.2
maintainer Applied
#3 lore raw
In reply to Leon Romanovsky
Quoted 12 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Changelog
v1:
* Delete "pd" cleanup line
* Moved all cleaned feilds to be last in declaration list to improve readability.
v0:
https://lore.kernel.org/lkml/[email protected]
------------------------------------------------------------------
Hi,

Quoted 8 lines

There are two change as were reported by kbuild. They are not important enough to have Fixes line.

Thanks

Leon Romanovsky (2):
RDMA/uverbs: Remove redundant assignments RDMA/uverbs: Silence shiftTooManyBitsSigned warning

Applied to for-next

Thanks,
Jason