2010-08-03 21:35:40

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 9/9] drivers/infiniband/hw/ehca: Drop unnecessary null test

From: Julia Lawall <[email protected]>

list_for_each_entry binds its first argument to a non-null value, and thus
any null test on the value of that argument is superfluous.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
iterator I;
expression x;
statement S,S1,S2;
@@

I(x,...) { <...
- if (x == NULL && ...) S
...> }
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/infiniband/hw/ehca/ehca_mrmw.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 31a68b9..53f4cd4 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -933,11 +933,6 @@ int ehca_unmap_fmr(struct list_head *fmr_list)
/* check all FMR belong to same SHCA, and check internal flag */
list_for_each_entry(ib_fmr, fmr_list, list) {
prev_shca = shca;
- if (!ib_fmr) {
- ehca_gen_err("bad fmr=%p in list", ib_fmr);
- ret = -EINVAL;
- goto unmap_fmr_exit0;
- }
shca = container_of(ib_fmr->device, struct ehca_shca,
ib_device);
e_fmr = container_of(ib_fmr, struct ehca_mr, ib.ib_fmr);


2010-08-04 18:50:10

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH 9/9] drivers/infiniband/hw/ehca: Drop unnecessary null test

Looks fine to me. ehca guys, any objection?
--
Roland Dreier <[email protected]> || For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html

2010-08-05 13:38:59

by Alexander Schmidt

[permalink] [raw]
Subject: Re: [PATCH 9/9] drivers/infiniband/hw/ehca: Drop unnecessary null test

On Wed, 04 Aug 2010 11:50:05 -0700
Roland Dreier <[email protected]> wrote:

> Looks fine to me. ehca guys, any objection?

We don't have any objections.

Acked-by: Alexander Schmidt <[email protected]>