diff mbox series

RDMA/uverbs: fix ptr_ret.cocci warnings

Message ID 20181127232130.GA28456@sof-kbuild01 (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/uverbs: fix ptr_ret.cocci warnings | expand

Commit Message

Fengguang Wu Nov. 27, 2018, 11:21 p.m. UTC
From: kbuild test robot <fengguang.wu@intel.com>

drivers/infiniband/core/uverbs_cmd.c:1095:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 7106a9769715 ("RDMA/uverbs: Make write() handlers return 0 on success")
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
---

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma for-next
head:   07f05f40d956d40f32852a7b3ff109a72d254cf9
commit: 7106a9769715bb4c0448927a29aa3b505855871c [31/37] RDMA/uverbs: Make write() handlers return 0 on success

 uverbs_cmd.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jason Gunthorpe Nov. 29, 2018, 11:37 p.m. UTC | #1
On Wed, Nov 28, 2018 at 07:21:30AM +0800, kbuild test robot wrote:
> From: kbuild test robot <fengguang.wu@intel.com>
> 
> drivers/infiniband/core/uverbs_cmd.c:1095:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> 
>  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Fixes: 7106a9769715 ("RDMA/uverbs: Make write() handlers return 0 on success")
> Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> ---

applied to for-next, thanks

Jason
Doug Ledford Dec. 3, 2018, 5:23 p.m. UTC | #2
On Thu, 2018-11-29 at 16:37 -0700, Jason Gunthorpe wrote:
> On Wed, Nov 28, 2018 at 07:21:30AM +0800, kbuild test robot wrote:
> > From: kbuild test robot <fengguang.wu@intel.com>
> > 
> > drivers/infiniband/core/uverbs_cmd.c:1095:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> > 
> > 
> >  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > 
> > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> > 
> > Fixes: 7106a9769715 ("RDMA/uverbs: Make write() handlers return 0 on success")
> > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > ---
> 
> applied to for-next, thanks
> 
> Jason

This caused a conflict with your make write() handlers use a consistent
flow series, which I fixed up during git am run.  Just FYI in case you
want to check out the conflict spot as a double check (but it was a
simple fixup).
Jason Gunthorpe Dec. 3, 2018, 8:47 p.m. UTC | #3
On Mon, Dec 03, 2018 at 12:23:35PM -0500, Doug Ledford wrote:
> On Thu, 2018-11-29 at 16:37 -0700, Jason Gunthorpe wrote:
> > On Wed, Nov 28, 2018 at 07:21:30AM +0800, kbuild test robot wrote:
> > > From: kbuild test robot <fengguang.wu@intel.com>
> > > 
> > > drivers/infiniband/core/uverbs_cmd.c:1095:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> > > 
> > > 
> > >  Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
> > > 
> > > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> > > 
> > > Fixes: 7106a9769715 ("RDMA/uverbs: Make write() handlers return 0 on success")
> > > Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
> > 
> > applied to for-next, thanks
> > 
> > Jason
> 
> This caused a conflict with your make write() handlers use a consistent
> flow series, which I fixed up during git am run.  Just FYI in case you
> want to check out the conflict spot as a double check (but it was a
> simple fixup).

Looks OK to me thanks

Jason
diff mbox series

Patch

--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1092,10 +1092,7 @@  static int ib_uverbs_create_cq(struct uv
 			sizeof(cmd.comp_channel), ib_uverbs_create_cq_cb,
 			NULL);
 
-	if (IS_ERR(obj))
-		return PTR_ERR(obj);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(obj);
 }
 
 static int ib_uverbs_ex_create_cq_cb(struct uverbs_attr_bundle *attrs,