Title: [8160] trunk/drivers/input/touchscreen: Fix ad7879_spi_xfer(): transfer value in during count==1 writes
Revision
8160
Author
hennerich
Date
2010-01-14 10:07:33 -0500 (Thu, 14 Jan 2010)

Log Message

Fix ad7879_spi_xfer(): transfer value in during count==1 writes
Fix bus_data initialization
Use kzalloc to avoid various issues due to bogus initialization.

Modified Paths

Diff

Modified: trunk/drivers/input/touchscreen/ad7879-i2c.c (8159 => 8160)


--- trunk/drivers/input/touchscreen/ad7879-i2c.c	2010-01-14 15:01:09 UTC (rev 8159)
+++ trunk/drivers/input/touchscreen/ad7879-i2c.c	2010-01-14 15:07:33 UTC (rev 8160)
@@ -55,7 +55,7 @@
 				      const struct i2c_device_id *id)
 {
 	struct ad7879_bus_ops bops = {
-		.bus_data = &client,
+		.bus_data = client,
 		.irq = client->irq,
 		.read = ad7879_i2c_read,
 		.multi_read = ad7879_i2c_multi_read,

Modified: trunk/drivers/input/touchscreen/ad7879-spi.c (8159 => 8160)


--- trunk/drivers/input/touchscreen/ad7879-spi.c	2010-01-14 15:01:09 UTC (rev 8159)
+++ trunk/drivers/input/touchscreen/ad7879-spi.c	2010-01-14 15:07:33 UTC (rev 8160)
@@ -46,7 +46,7 @@
 	struct spi_transfer *xfers;
 	void *spi_data;
 	u16 *command;
-	u16 *_tx_buf = _tx_buf, *_rx_buf = _rx_buf; /* shut gcc up */
+	u16 *_rx_buf = _rx_buf; /* shut gcc up */
 	u8 idx;
 	int ret;
 
@@ -57,12 +57,12 @@
 	spi_message_init(&msg);
 
 	command = spi_data;
-	*command = cmd;
+	command[0] = cmd;
 	if (count == 1) {
 		/* ad7879_spi_{read,write} gave us buf on stack */
-		_rx_buf = rx_buf;
-		_tx_buf = tx_buf;
+		command[1] = *tx_buf;
 		tx_buf = &command[1];
+		_rx_buf = rx_buf;
 		rx_buf = &command[2];
 	}
 
@@ -82,10 +82,9 @@
 	}
 
 	ret = spi_sync(spi, &msg);
-	if (count == 1) {
-		_tx_buf[0] = command[1];
+
+	if (count == 1)
 		_rx_buf[0] = command[2];
-	}
 
 	kfree(spi_data);
 
@@ -112,7 +111,7 @@
 static int __devinit ad7879_spi_probe(struct spi_device *spi)
 {
 	struct ad7879_bus_ops bops = {
-		.bus_data = &spi,
+		.bus_data = spi,
 		.irq = spi->irq,
 		.read = ad7879_spi_read,
 		.multi_read = ad7879_spi_multi_read,

Modified: trunk/drivers/input/touchscreen/ad7879.c (8159 => 8160)


--- trunk/drivers/input/touchscreen/ad7879.c	2010-01-14 15:01:09 UTC (rev 8159)
+++ trunk/drivers/input/touchscreen/ad7879.c	2010-01-14 15:07:33 UTC (rev 8160)
@@ -384,7 +384,7 @@
 
 	err = -ENOMEM;
 
-	ts = kmalloc(sizeof(*ts), GFP_KERNEL);
+	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
 	if (!ts)
 		goto err_free_ts_mem;
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to