lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211019091416.16923-1-Meng.Li@windriver.com>
Date:   Tue, 19 Oct 2021 17:14:16 +0800
From:   Meng Li <Meng.Li@...driver.com>
To:     wg@...ndegger.com, mkl@...gutronix.de, davem@...emloft.net,
        kuba@...nel.org, mailhol.vincent@...adoo.fr,
        socketcan@...tkopp.net, ramesh.shanmugasundaram@...renesas.com
Cc:     linux-can@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, meng.li@...driver.com
Subject: [PATCH] driver: net: can: disable clock when it is in enable status

If disable a clock when it is already in disable status, there
will be a warning trace generated. So, it is need to confirm
whether what status the clock is in before disable it.

Fixes: a23b97e6255b ("can: rcar_can: Move Renesas CAN driver to rcar dir")
Cc: stable@...r.kernel.org
Signed-off-by: Meng Li <Meng.Li@...driver.com>
---
 drivers/net/can/rcar/rcar_can.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_can.c
index 48575900adb7..e340e32cd145 100644
--- a/drivers/net/can/rcar/rcar_can.c
+++ b/drivers/net/can/rcar/rcar_can.c
@@ -15,6 +15,7 @@
 #include <linux/can/led.h>
 #include <linux/can/dev.h>
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/of.h>
 
 #define RCAR_CAN_DRV_NAME	"rcar_can"
@@ -857,7 +858,9 @@ static int __maybe_unused rcar_can_suspend(struct device *dev)
 	writew(ctlr, &priv->regs->ctlr);
 	priv->can.state = CAN_STATE_SLEEPING;
 
-	clk_disable(priv->clk);
+	if(__clk_is_enabled(priv->clk))
+		clk_disable(priv->clk);
+
 	return 0;
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ