Skip to contentSkip to conversation

fix SMBus write_byte ioctl

PATCH New Hideki IWAMOTO 1 participant 1 message Sep 25, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix SMBus write_byte ioctl

i2c_smbus_xfer needs the structure i2c_smbus_data for write_byte with SW PEC. However, NULL is passed from i2cdev_ioctl.
Currently

	ioctl(fd,I2C_PEC,1);
	i2c_smbus_write_byte(fd,value);

causes NULL pointer access in i2c_smbus_add_pec.

Index: kernel/i2c-dev.c
=================================RCS file: /home/cvs/i2c/kernel/i2c-dev.c,v retrieving revision 1.61

i2c-dev.c +2 -1
diff -u -r1.61 i2c-dev.c
@@ -329,7 +329,8 @@
 			                      client->flags,
 			                      data_arg.read_write,
 			                      data_arg.command,
-			                      data_arg.size, NULL);
+			                      data_arg.size,
+			                      (data_arg.size = I2C_SMBUS_QUICK) ? NULL : &temp);
 
 		if (data_arg.data = NULL) {
 #ifdef DEBUG

----
Hideki IWAMOTO [email protected]