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

Commit 0743490a 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 f6f08a90
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */
 */


#include <linux/debugfs.h>
#include <linux/debugfs.h>
@@ -730,6 +730,10 @@ static irqreturn_t qti_haptics_play_irq_handler(int irq, void *data)
	int rc;
	int rc;


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

	if (effect == NULL)
		goto handled;

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