[PATCH 7/8] drivers/scsi/scsi_transport_fc.c: drop if around WARN_ON

From: Julia Lawall
Date: Sat Nov 03 2012 - 16:31:22 EST


From: Julia Lawall <Julia.Lawall@xxxxxxx>

Just use WARN_ON rather than an if containing only WARN_ON(1).

A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e;
@@
- if (e) WARN_ON(1);
+ WARN_ON(e);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>

---
drivers/scsi/scsi_transport_fc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index e894ca7..f54c945 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1699,9 +1699,8 @@ fc_stat_show(const struct device *dev, char *buf, unsigned long offset)
struct fc_host_statistics *stats;
ssize_t ret = -ENOENT;

- if (offset > sizeof(struct fc_host_statistics) ||
- offset % sizeof(u64) != 0)
- WARN_ON(1);
+ WARN_ON(offset > sizeof(struct fc_host_statistics) ||
+ offset % sizeof(u64) != 0);

if (i->f->get_fc_host_stats) {
stats = (i->f->get_fc_host_stats)(shost);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/