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: <20191205071953.121511-3-wvw@google.com>
Date:   Wed,  4 Dec 2019 23:19:52 -0800
From:   Wei Wang <wvw@...gle.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     wei.vince.wang@...il.com, Wei Wang <wvw@...gle.com>,
        Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amit.kucheria@...durent.com>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/3] thermal: improve error message in thermal zone registration

Follow up with commit 67eed44b8a8a ("thermal: Add some error messages")
to clean up checkpatch warning on line length and also add more message
for developers.

Signed-off-by: Wei Wang <wvw@...gle.com>
---
 drivers/thermal/thermal_core.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 974e2d91c30b..9db7f72e70f8 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1255,29 +1255,33 @@ thermal_zone_device_register(const char *type, int trips, int mask,
 	int count;
 	struct thermal_governor *governor;
 
-	if (!type || strlen(type) == 0) {
+	if (!type || !type[0]) {
 		pr_err("Error: No thermal zone type defined\n");
 		return ERR_PTR(-EINVAL);
 	}
 
-	if (type && strlen(type) >= THERMAL_NAME_LENGTH) {
-		pr_err("Error: Thermal zone name (%s) too long, should be under %d chars\n",
-		       type, THERMAL_NAME_LENGTH);
+	if (strlen(type) >= THERMAL_NAME_LENGTH) {
+		pr_err("Error: Thermal zone name over %d chars: %s\n",
+			THERMAL_NAME_LENGTH, type);
 		return ERR_PTR(-EINVAL);
 	}
 
 	if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) {
-		pr_err("Error: Incorrect number of thermal trips\n");
+		pr_err("Error: Incorrect number of thermal trips: %s\n", type);
 		return ERR_PTR(-EINVAL);
 	}
 
 	if (!ops) {
-		pr_err("Error: Thermal zone device ops not defined\n");
+		pr_err("Error: Thermal zone device ops not defined: %s\n",
+			type);
 		return ERR_PTR(-EINVAL);
 	}
 
-	if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp))
+	if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp)) {
+		pr_err("Error: Thermal zone device missing callback: %s\n",
+			type);
 		return ERR_PTR(-EINVAL);
+	}
 
 	tz = kzalloc(sizeof(*tz), GFP_KERNEL);
 	if (!tz)
-- 
2.24.0.393.g34dc348eaf-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ