[PATCH 14/15] staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prior to calling this function pci_ioremap_bar() is called. If the
pci_resource_len(), i.e. the 'size', was 0 the ioremap would fail
so this function would never be called. So the first BUG_ON() can
never occur.

The 'order' returned by ilog2() will always be > 0 so the second
BUG_ON() will also never occur.

Remove the unnecessary BUG_ON() checks and tidy up the function.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/mite.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index d5475cd..2233a41 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -157,12 +157,7 @@
 
 static unsigned int MITE_IODWBSR_1_WSIZE_bits(unsigned int size)
 {
-	unsigned int order = 0;
-
-	BUG_ON(size == 0);
-	order = ilog2(size);
-	BUG_ON(order < 1);
-	return (order - 1) & 0x1f;
+	return (ilog2(size) - 1) & 0x1f;
 }
 
 static unsigned int mite_retry_limit(unsigned int retry_limit)
-- 
2.6.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux