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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1606394409-12755-4-git-send-email-abel.vesa@nxp.com>
Date:   Thu, 26 Nov 2020 14:40:07 +0200
From:   Abel Vesa <abel.vesa@....com>
To:     Stephen Boyd <sboyd@...nel.org>,
        Sascha Hauer <kernel@...gutronix.de>,
        Peng Fan <peng.fan@....com>,
        Fabio Estevam <fabio.estevam@....com>,
        Anson Huang <anson.huang@....com>,
        Dong Aisheng <aisheng.dong@....com>,
        Jacky Bai <ping.bai@....com>
Cc:     NXP Linux Team <linux-imx@....com>, linux-clk@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-arm-kernel@...ts.infradead.org, Abel Vesa <abel.vesa@....com>
Subject: [PATCH v2 3/5] clk: composite: Allow gate ops with only .is_enabled op

Some composite clocks might be enabled/disabled from outside the
clock framework. So allow the composite clock register successfully
with only the .is_enabled op for gate ops.

Signed-off-by: Abel Vesa <abel.vesa@....com>
---
 drivers/clk/clk-composite.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 2ddb54f..29f00a9 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -278,17 +278,18 @@ static struct clk_hw *__clk_hw_register_composite(struct device *dev,
 	}
 
 	if (gate_hw && gate_ops) {
-		if (!gate_ops->is_enabled || !gate_ops->enable ||
-		    !gate_ops->disable) {
-			hw = ERR_PTR(-EINVAL);
-			goto err;
-		}
-
 		composite->gate_hw = gate_hw;
 		composite->gate_ops = gate_ops;
-		clk_composite_ops->is_enabled = clk_composite_is_enabled;
-		clk_composite_ops->enable = clk_composite_enable;
-		clk_composite_ops->disable = clk_composite_disable;
+		if (gate_ops->is_enabled) {
+			clk_composite_ops->is_enabled = clk_composite_is_enabled;
+		} else {
+			hw = ERR_PTR(-EINVAL);
+			goto err;
+		}
+		if (gate_ops->enable)
+			clk_composite_ops->enable = clk_composite_enable;
+		if (gate_ops->disable)
+			clk_composite_ops->disable = clk_composite_disable;
 	}
 
 	init.ops = clk_composite_ops;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ