Non-portable code in em28XX driver

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

 



Dear Mauro,
In your patch 12406 to v4l-dvb dev tree there is a small problem:
--

diff -r 13a35e80e987 -r 8f9eee4fd803
linux/drivers/media/video/em28xx/em28xx-core.c
--- a/linux/drivers/media/video/em28xx/em28xx-core.c    Fri Aug 07 18:43:00
2009 -0300
+++ b/linux/drivers/media/video/em28xx/em28xx-core.c    Sat Aug 08 03:14:55
2009 -0300
@@ -720,7 +720,10 @@
 {
        int width, height;
        width = norm_maxw(dev);
-       height = norm_maxh(dev) >> 1;
+       height = norm_maxh(dev);
+
+       if (!dev->progressive)
+               height >>= norm_maxh(dev);

        em28xx_set_outfmt(dev);

--
In the line "height >>= norm_maxh(dev)" undefinedÂbehaviorÂhas been
introduced. There is an attempt to shift the number to a big number of
bits which is not defined by C standard and leads to unpredictable
results. For example it will work on Intel because there it will
translate to no shift at all which seems to be unexpected as well. But
if you enable global optimization or compile this code for ARM the
result will be 0.
It seems like this line should look like "height = norm_maxh(dev) >> 1"
--
With best regards,
Vitaly Makarov
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux