From ebb3f320edcc6c4665a71ea060ef2ce6a83402b0 Mon Sep 17 00:00:00 2001 From: merge Date: Mon, 8 Dec 2008 22:50:52 +0000 Subject: MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-fix-s3c2410_ts-fifo-allocation-1228776491 pending-tracking-hist top was MERGE-via-stable-tracking-fix-s3c2410_ts-fifo-allocation-1228776491 / a85a8a282939b4f6800081f67e1d568e0b97bd7a ... parent commitmessage: From: merge MERGE-via-stable-tracking-hist-fix-s3c2410_ts-fifo-allocation stable-tracking-hist top was fix-s3c2410_ts-fifo-allocation / 56a57ba0d4c1d60869250d5f89fae61544f01012 ... parent commitmessage: From: Nelson Castillo Fix s3c2410_ts FIFO allocation When I added the FIFO improving the interrupts handlers I introduced a bug. The FIFO is allocated after the interrupts are requested. This makes the kernel crash if the touchscreen generates activity before the allocation takes place. This patch fixes the bug. I reproduced it and tested the fix in a GTA02. - Fix bug - Fix a typo Reported-by: Andy Green Signed-off-by: Nelson Castillo --- drivers/input/touchscreen/s3c2410_ts.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'drivers/input/touchscreen/s3c2410_ts.c') diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 8e6bc0a0371..4159adaec7c 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c @@ -427,6 +427,11 @@ static int __init s3c2410ts_probe(struct platform_device *pdev) ts.dev->id.product = 0xBEEF; ts.dev->id.version = S3C2410TSVERSION; ts.state = TS_STATE_STANDBY; + ts.event_fifo = kfifo_alloc(TS_EVENT_FIFO_SIZE, GFP_KERNEL, NULL); + if (IS_ERR(ts.event_fifo)) { + ret = -EIO; + goto bail2; + } /* create the filter chain set up for the 2 coordinates we produce */ ret = ts_filter_create_chain( @@ -459,26 +464,17 @@ static int __init s3c2410ts_probe(struct platform_device *pdev) goto bail4; } - ts.event_fifo = kfifo_alloc(TS_EVENT_FIFO_SIZE, GFP_KERNEL, NULL); - - if (IS_ERR(ts.event_fifo)) { - ret = -EIO; - goto bail5; - } - dev_info(&pdev->dev, "successfully loaded\n"); /* All went ok, so register to the input system */ rc = input_register_device(ts.dev); if (rc) { ret = -EIO; - goto bail6; + goto bail5; } return 0; -bail6: - kfifo_free(ts.event_fifo); bail5: free_irq(IRQ_TC, ts.dev); free_irq(IRQ_ADC, ts.dev); @@ -489,7 +485,8 @@ bail4: disable_irq(IRQ_ADC); bail3: ts_filter_destroy_chain(ts.tsf); - + kfifo_free(ts.event_fifo); +bail2: input_unregister_device(ts.dev); bail1: iounmap(base_addr); -- cgit v1.2.3