Commit f7c77a3d authored by Takashi Iwai's avatar Takashi Iwai Committed by Guenter Roeck

hwmon: (lis3) Fix Oops with NULL platform data

The recent addition of threaded irq handler causes a NULL dereference
when used with hp_accel driver, which has NULL pdata.
Acked-by: default avatarSamu Onkalo <samu.p.onkalo@nokia.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent a850ea30
...@@ -277,7 +277,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy) ...@@ -277,7 +277,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
wake_up_interruptible(&lis3_dev.misc_wait); wake_up_interruptible(&lis3_dev.misc_wait);
kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN);
out: out:
if (lis3_dev.whoami == WAI_8B && lis3_dev.idev && if (lis3_dev.pdata && lis3_dev.whoami == WAI_8B && lis3_dev.idev &&
lis3_dev.idev->input->users) lis3_dev.idev->input->users)
return IRQ_WAKE_THREAD; return IRQ_WAKE_THREAD;
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -718,7 +718,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) ...@@ -718,7 +718,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
* io-apic is not configurable (and generates a warning) but I keep it * io-apic is not configurable (and generates a warning) but I keep it
* in case of support for other hardware. * in case of support for other hardware.
*/ */
if (dev->whoami == WAI_8B) if (dev->pdata && dev->whoami == WAI_8B)
thread_fn = lis302dl_interrupt_thread1_8b; thread_fn = lis302dl_interrupt_thread1_8b;
else else
thread_fn = NULL; thread_fn = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment