The patch number 12342 was added via Mauro Carvalho Chehab <mche...@redhat.com>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Jan Nikitenko  <jan.nikite...@gmail.com>
af9015: avoid magically sized temporary buffer in eeprom_dump


Replace printing to magically sized temporary buffer with use
of KERN_CONT for continual printing of eeprom registers dump.

Since deb_info is defined as dprintk, which is conditionally defined
to printk without additional parameters, meaning that deb_info is equivalent
to direct printk (without adding KERN_ facility), we can use KERN_DEBUG and
KERN_CONT in there, eliminating the need for sprintf into temporary buffer
with not easily readable/magical size.

Though it's strange, that deb_info definition uses printk without KERN_
facility and callers don't use it either.

Signed-off-by: Jan Nikitenko <jan.nikite...@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 linux/drivers/media/dvb/dvb-usb/af9015.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff -r b8e9c2b2a2a8 -r 81e6ad47ff8c linux/drivers/media/dvb/dvb-usb/af9015.c
--- a/linux/drivers/media/dvb/dvb-usb/af9015.c  Thu Jun 18 11:11:57 2009 +0000
+++ b/linux/drivers/media/dvb/dvb-usb/af9015.c  Mon Jul 27 19:05:19 2009 -0300
@@ -541,24 +541,22 @@
 /* dump eeprom */
 static int af9015_eeprom_dump(struct dvb_usb_device *d)
 {
-       char buf[4+3*16+1], buf2[4];
        u8 reg, val;
 
        for (reg = 0; ; reg++) {
                if (reg % 16 == 0) {
                        if (reg)
-                               deb_info("%s\n", buf);
-                       sprintf(buf, "%02x: ", reg);
+                               deb_info(KERN_CONT "\n");
+                       deb_info(KERN_DEBUG "%02x:", reg);
                }
                if (af9015_read_reg_i2c(d, AF9015_I2C_EEPROM, reg, &val) == 0)
-                       sprintf(buf2, "%02x ", val);
+                       deb_info(KERN_CONT " %02x", val);
                else
-                       strcpy(buf2, "-- ");
-               strcat(buf, buf2);
+                       deb_info(KERN_CONT " --");
                if (reg == 0xff)
                        break;
        }
-       deb_info("%s\n", buf);
+       deb_info(KERN_CONT "\n");
        return 0;
 }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/81e6ad47ff8c6af3bbce67d67d9d943a40bdf75c

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to