[Chris: Thanks for accepting my last too patch messages so quickly.  I do 
understand your being being "livelocked" and sympathize with you.  Here is 
another reworked oldie.]

ivtv-0.3.3c has several printf-like calls that won't work on x86_64
and probably a number of other architectures.

I have attached patches to ivtv-0.3.3c/driver (apply them while in that 
directory).

Explanation:

sizeof is defined to return an unsigned integral type, but it might be
unsigned int, unsigned long, or even unsigned long long.  So using %d
to format the result of sizeof is wrong in two ways: the value is
unsigned whereas %d is for signed int values; the result may be of
type wider than int.

In each place where this was used, I judged that the object to which
sizeof was applied would be quite small.  So I changed the format to
%u and cast the sizeof expression to unsigned.  This should work on
any system.

A different problem occurred in ivtv-osd.c.  An IVTV_DEBUG call
displays an address.  It used a format of 0x%08x and cast the
pointer to (u32).  To make this more universal, I substituted a format
of %8p and eliminated the cast.
===================================================================
RCS file: RCS/cx25840-driver.c,v
retrieving revision 1.1
diff -u -r1.1 cx25840-driver.c
--- cx25840-driver.c    2005/04/19 05:10:17     1.1
+++ cx25840-driver.c    2005/04/19 05:13:50
@@ -1413,7 +1413,7 @@
        client->adapter = adapter;
        client->driver = &i2c_driver_cx25840;
        client->flags = I2C_CLIENT_ALLOW_USE;
-       snprintf(client->name, sizeof(client->name) - 1, "cx25840[%d]", 
sizeof(I2C_NAME(client)));
+       snprintf(client->name, sizeof(client->name) - 1, "cx25840[%u]", 
(unsigned)sizeof(I2C_NAME(client)));
 
        state = kmalloc(sizeof(struct cx25840_state), GFP_KERNEL);
        i2c_set_clientdata(client, state);
===================================================================
RCS file: RCS/ivtv-osd.c,v
retrieving revision 1.1
diff -u -r1.1 ivtv-osd.c
--- ivtv-osd.c  2005/04/19 05:12:27     1.1
+++ ivtv-osd.c  2005/04/19 05:49:12
@@ -1274,10 +1274,10 @@
                if (ret) {
                        if (ret != -ERESTARTSYS) {
                                IVTV_DEBUG(IVTV_DEBUG_ERR,
-                                          "OSD: DMA xfer from 0x%08x of "
+                                          "OSD: DMA xfer from %8p of "
                                           "%d bytes "
-                                          "failed with (%d) offset = 0x%08lx, 
total %d\n",
-                                          (u32) args.source, args.count, ret,
+                                          "failed with (%d) offset = 0x%0lx, 
total %d\n",
+                                          args.source, args.count, ret,
                                           args.dest_offset,
                                           (args.count +
                                            (unsigned int)args.dest_offset));
===================================================================
RCS file: RCS/saa7115.c,v
retrieving revision 1.1
diff -u -r1.1 saa7115.c
--- saa7115.c   2005/04/19 05:08:40     1.1
+++ saa7115.c   2005/04/19 05:13:50
@@ -1153,8 +1153,8 @@
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7115;
        client->flags = I2C_CLIENT_ALLOW_USE;
-       snprintf(client->name, sizeof(client->name) - 1, "saa7115[%d]",
-                sizeof(I2C_NAME(client)));
+       snprintf(client->name, sizeof(client->name) - 1, "saa7115[%u]",
+                (unsigned)sizeof(I2C_NAME(client)));
 
        state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL);
        i2c_set_clientdata(client, state);
===================================================================
RCS file: RCS/tveeprom.c,v
retrieving revision 1.1
diff -u -r1.1 tveeprom.c
--- tveeprom.c  2005/04/19 05:13:18     1.1
+++ tveeprom.c  2005/04/19 05:13:50
@@ -655,8 +655,8 @@
        client->adapter = adapter;
        client->driver = &i2c_driver_tveeprom;
        client->flags = I2C_CLIENT_ALLOW_USE;
-       snprintf(client->name, sizeof(client->name) - 1, "tveeprom[%d]",
-                sizeof(I2C_NAME(client)));
+       snprintf(client->name, sizeof(client->name) - 1, "tveeprom[%u]",
+                (unsigned)sizeof(I2C_NAME(client)));
 
        eeprom = kmalloc(sizeof(struct tveeprom), GFP_KERNEL);
        if (eeprom == NULL) {
===================================================================
RCS file: RCS/wm8775.c,v
retrieving revision 1.1
diff -u -r1.1 wm8775.c
--- wm8775.c    2005/04/19 05:12:58     1.1
+++ wm8775.c    2005/04/19 05:13:50
@@ -483,7 +483,7 @@
        client->adapter = adapter;
        client->driver = &i2c_driver;
        client->flags = I2C_CLIENT_ALLOW_USE;
-       snprintf(client->name, sizeof(client->name) - 1, MOD_NAME "[%d]",  
sizeof(I2C_NAME(client)));
+       snprintf(client->name, sizeof(client->name) - 1, MOD_NAME "[%u]",  
(unsigned)sizeof(I2C_NAME(client)));
 
        {
                wm8775_reg_set *state;

Reply via email to