From d3dd2a1713f37da895218b40724e616c53dd4be4 Mon Sep 17 00:00:00 2001 From: Bhaumik Bhatt Date: Tue, 5 Jan 2021 17:52:00 -0800 Subject: [PATCH] bus: mhi: host: Prevent warnings on clearing channel context twice Do not allow clearing the channel context twice from mhi_driver_remove(), if already done before disable transition is initiated. This prevents kernel warnings such as "trying to free invalid coherent area" from occurring. Change-Id: I85dec0557a287c9207b56d2b2243d53b6a40ff1c Signed-off-by: Bhaumik Bhatt Signed-off-by: Lazarus Motha --- drivers/bus/mhi/host/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index bf672de35131..da9eb79b1561 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. * */ @@ -1359,6 +1359,7 @@ static int mhi_driver_remove(struct device *dev) if ((ch_state[dir] == MHI_CH_STATE_ENABLED || ch_state[dir] == MHI_CH_STATE_STOP) && + mhi_chan->ch_state != MHI_CH_STATE_DISABLED && !mhi_chan->offload_ch) mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan);