Commit 7024cc88 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: mite: remove BUG_ON() in MITE_IODWBSR_1_WSIZE_bits()

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43d66724
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment