Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d18454f authored by Fenglin Wu's avatar Fenglin Wu
Browse files

input: misc: qti-haptics: check NULL pointer before using it



There might be a rare case that previous play has been terminated and the
next play is generating in VMAX mode so that the play effect pointer would
be set to NULL before the play IRQ being served. So check the effect
pointer before using it in the play IRQ handler.

Change-Id: I2d9ace5d09ffde885b4267e1e78771a169c57bec
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 2d0bbcbf
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -737,6 +737,10 @@ static irqreturn_t qti_haptics_play_irq_handler(int irq, void *data)
	int rc;

	dev_dbg(chip->dev, "play_irq triggered\n");

	if (effect == NULL)
		goto handled;

	if (play->playing_pos == effect->pattern_length) {
		dev_dbg(chip->dev, "waveform playing done\n");
		if (chip->play_irq_en) {