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

Commit ea4e289c authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Sasha Levin
Browse files

spi: trigger trace event for message-done before mesg->complete



[ Upstream commit 391949b6f02121371e3d7d9082c6d17fd9853034 ]

With spidev the mesg->complete callback points to spidev_complete.
Calling this unblocks spidev_sync and so spidev_sync_write finishes. As
the struct spi_message just read is a local variable in
spidev_sync_write and recording the trace event accesses this message
the recording is better done first. The same can happen for
spidev_sync_read.

This fixes an oops observed on a 3.14-rt system with spidev activity
after

	echo 1 > /sys/kernel/debug/tracing/events/spi/enable

.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 7cc582d4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1073,13 +1073,14 @@ void spi_finalize_current_message(struct spi_master *master)
				"failed to unprepare message: %d\n", ret);
		}
	}

	trace_spi_message_done(mesg);

	master->cur_msg_prepared = false;

	mesg->state = NULL;
	if (mesg->complete)
		mesg->complete(mesg->context);

	trace_spi_message_done(mesg);
}
EXPORT_SYMBOL_GPL(spi_finalize_current_message);