[PATCH 3/6] mrst-touchscreen: Fix use before initialize in mrst_touch [Fix bug 2561]

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

 



From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>

The mrst touch screen driver, in mrstouch_adc_init does

                 dev_err(&tsdev->spi->dev, "Unable to read PMIC id\n");

which does not work very well since the tsdev->spi member does not get
initialized until after the call to mrstouch_adc_init

this patch makes sure the ->spi member is initialized prior to the call
to mrstouch_adc_init

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>


--- linux-2.6.34/drivers/staging/mrst-touchscreen/intel-mid-touch.c~
  2010-06-23 03:13:39.000000000 +0000
+++ linux-2.6.34/drivers/staging/mrst-touchscreen/intel-mid-touch.c
  2010-06-23 03:14:47.736742734 +0000
@@ -759,6 +759,8 @@
      tsdev->irq = myirq;
      mrstouchdevp = tsdev;

+    tsdev->spi = mrstouch_spi;
+
      err = mrstouch_adc_init(tsdev);
      if (err) {
          dev_err(&mrstouch_spi->dev, "ADC init failed\n");
@@ -766,7 +768,6 @@
      }

      dev_set_drvdata(&mrstouch_spi->dev, tsdev);
-    tsdev->spi = mrstouch_spi;

      err = ts_input_dev_init(tsdev, mrstouch_spi);
      if (err) {


--------------030606040305060606070104
Content-Type: text/plain;
 name="Q"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="Q"

--- linux-2.6.34/drivers/staging/mrst-touchscreen/intel-mid-touch.c~	2010-06-23 03:13:39.000000000 +0000
+++ linux-2.6.34/drivers/staging/mrst-touchscreen/intel-mid-touch.c	2010-06-23 03:14:47.736742734 +0000
@@ -759,6 +759,8 @@
 	tsdev->irq = myirq;
 	mrstouchdevp = tsdev;

+	tsdev->spi = mrstouch_spi;
+
 	err = mrstouch_adc_init(tsdev);
 	if (err) {
 		dev_err(&mrstouch_spi->dev, "ADC init failed\n");
@@ -766,7 +768,6 @@
 	}

 	dev_set_drvdata(&mrstouch_spi->dev, tsdev);
-	tsdev->spi = mrstouch_spi;

 	err = ts_input_dev_init(tsdev, mrstouch_spi);
 	if (err) {

--------------030606040305060606070104--
---

 drivers/staging/mrst-touchscreen/intel-mid-touch.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
index 7e77737..c41989b 100644
--- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c
+++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
@@ -651,6 +651,8 @@ static int __devinit mrstouch_probe(struct spi_device *spi)
 	snprintf(tsdev->phys, sizeof(tsdev->phys),
 		 "%s/input0", dev_name(&spi->dev));
 
+	tsdev->spi = mrstouch_spi;
+
 	err = mrstouch_adc_init(tsdev);
 	if (err) {
 		dev_err(&spi->dev, "ADC initialization failed\n");

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux