From: Alexander Usyskin Date: Tue, 15 Feb 2022 08:04:38 +0000 (+0200) Subject: mei: do not overwrite state on hw start X-Git-Tag: v6.1-rc5~1693^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2be483f12ea34b43826f70c60f0924a7bda991bd;p=platform%2Fkernel%2Flinux-starfive.git mei: do not overwrite state on hw start During the hardware start sequence, do not overwrite the driver state and do not proceed with the initialization sequence if the state was changed while the driver was waiting for the start interrupt. This can happen if the driver's removal/stop procedure was triggered from the parent level while the driver is waiting for the start interrupt. This may lead to stray the reset work or the timer after driver were removed. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20220215080438.264876-4-tomas.winkler@intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index f79076c6..eb05200 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c @@ -161,6 +161,11 @@ int mei_reset(struct mei_device *dev) return ret; } + if (dev->dev_state != MEI_DEV_RESETTING) { + dev_dbg(dev->dev, "wrong state = %d on link start\n", dev->dev_state); + return 0; + } + dev_dbg(dev->dev, "link is established start sending messages.\n"); mei_set_devstate(dev, MEI_DEV_INIT_CLIENTS);