Staging: mrst-touchscreen: fix dereferencing free memory
authorDan Carpenter <error27@gmail.com>
Sat, 5 Jun 2010 17:16:42 +0000 (19:16 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 30 Jun 2010 15:18:14 +0000 (08:18 -0700)
I moved the kfree() down a couple lines after the dereference.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/mrst-touchscreen/intel-mid-touch.c

index 1db00975a594ec8e859ab81db32a1db9acac22c5..abba22f921bec49b8f4d58123f33c8e01947380e 100644 (file)
@@ -817,9 +817,9 @@ static int mrstouch_remove(struct spi_device *spi)
        free_irq(mrstouchdevp->irq, mrstouchdevp);
        input_unregister_device(mrstouchdevp->input);
        input_free_device(mrstouchdevp->input);
-       kfree(mrstouchdevp);
        if (mrstouchdevp->pendet_thrd)
                kthread_stop(mrstouchdevp->pendet_thrd);
+       kfree(mrstouchdevp);
        return 0;
 }