coresight: Add try_get_module() in coresight_grab_device()
authorTingwei Zhang <tingwei@codeaurora.org>
Mon, 28 Sep 2020 16:34:54 +0000 (10:34 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Sep 2020 17:47:40 +0000 (19:47 +0200)
commit32b0707a418219b38e17276075962e25e912d4b2
treedf2c1adeb20cc12f5d0a793a7c640343e7d155a2
parentd735d925f9a5029b8aaa5983d63c74f5cb4bfec0
coresight: Add try_get_module() in coresight_grab_device()

When coresight device is in an active session, driver module of
that device should not be removed. Use try_get_module() in
coresight_grab_device() to prevent module to be unloaded.
Use get_device()/put_device() to protect device data
in the middle of active session.

Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200928163513.70169-7-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight.c