From 20e817d30c746817e8ad2299956730be134ddd0d Mon Sep 17 00:00:00 2001 From: Can Guo Date: Mon, 5 Jun 2017 12:00:03 +0800 Subject: mmc: debugfs: fix unclocked register access by force_error When echo values to debugfs entry force_error, unclocked register access error would be detected. This change fixes it by making sure the host is powered up and host clock is ticking before access force event register for error interrupt status. Change-Id: I995523d64de36cd4872209db4a558aa83103fbb3 Signed-off-by: Can Guo --- drivers/mmc/core/debugfs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 594fba08e623..72bfdd835178 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -337,10 +337,15 @@ static int mmc_force_err_set(void *data, u64 val) { struct mmc_host *host = data; - if (host && host->ops && host->ops->force_err_irq) { - mmc_host_clk_hold(host); + if (host && host->card && host->ops && + host->ops->force_err_irq) { + /* + * To access the force error irq reg, we need to make + * sure the host is powered up and host clock is ticking. + */ + mmc_get_card(host->card); host->ops->force_err_irq(host, val); - mmc_host_clk_release(host); + mmc_put_card(host->card); } return 0; -- cgit v1.2.3