Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1295471 > unrolled thread
| Started by | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| First post | 2015-12-19 22:10 +0100 |
| Last post | 2015-12-23 17:20 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] IB/usnic: delete unneeded IS_ERR test Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-19 22:10 +0100
Re: [PATCH] IB/usnic: delete unneeded IS_ERR test Dave Goodell <dgoodell@cisco.com> - 2015-12-22 16:40 +0100
Re: [PATCH] IB/usnic: delete unneeded IS_ERR test Doug Ledford <dledford@redhat.com> - 2015-12-23 17:20 +0100
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2015-12-19 22:10 +0100 |
| Subject | [PATCH] IB/usnic: delete unneeded IS_ERR test |
| Message-ID | <qHwVk-8mU-11@gated-at.bofh.it> |
kzalloc doesn't return ERR_PTR, so there is no need to test for it. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,e; @@ * x = kzalloc(...) ... when != x = e * IS_ERR_OR_NULL(x) // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index f8e3211..20f53e5 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -625,8 +625,8 @@ struct ib_mr *usnic_ib_reg_mr(struct ib_pd *pd, u64 start, u64 length, virt_addr, length); mr = kzalloc(sizeof(*mr), GFP_KERNEL); - if (IS_ERR_OR_NULL(mr)) - return ERR_PTR(mr ? PTR_ERR(mr) : -ENOMEM); + if (!mr) + return ERR_PTR(-ENOMEM); mr->umem = usnic_uiom_reg_get(to_upd(pd)->umem_pd, start, length, access_flags, 0); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Dave Goodell <dgoodell@cisco.com> |
|---|---|
| Date | 2015-12-22 16:40 +0100 |
| Message-ID | <qIxcC-5Ia-3@gated-at.bofh.it> |
| In reply to | #1295471 |
[copying Nelson too] On Sat, Dec 19, 2015 at 09:48:59PM +0100, Julia Lawall wrote: > kzalloc doesn't return ERR_PTR, so there is no need to test for it. > > The semantic match that finds this problem is as follows: > (http://coccinelle.lip6.fr/) > > // <smpl> > @@ > expression x,e; > @@ > > * x = kzalloc(...) > ... when != x = e > * IS_ERR_OR_NULL(x) > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Dave Goodell <dgoodell@cisco.com> -Dave -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Doug Ledford <dledford@redhat.com> |
|---|---|
| Date | 2015-12-23 17:20 +0100 |
| Message-ID | <qIUiR-3tm-1@gated-at.bofh.it> |
| In reply to | #1296839 |
[Multipart message — attachments visible in raw view] — view raw
On 12/22/2015 10:29 AM, Dave Goodell wrote:
> [copying Nelson too]
>
> On Sat, Dec 19, 2015 at 09:48:59PM +0100, Julia Lawall wrote:
>> kzalloc doesn't return ERR_PTR, so there is no need to test for it.
>>
>> The semantic match that finds this problem is as follows:
>> (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @@
>> expression x,e;
>> @@
>>
>> * x = kzalloc(...)
>> ... when != x = e
>> * IS_ERR_OR_NULL(x)
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Reviewed-by: Dave Goodell <dgoodell@cisco.com>
>
> -Dave
>
Thanks, applied.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web