Re: [PATCH] thermal: Add some error messages

From: Joe Perches
Date: Wed Jul 10 2019 - 20:14:45 EST


On Wed, 2019-07-10 at 17:16 +0530, Amit Kucheria wrote:
> When registering a thermal zone device, we currently return -EINVAL in
> four cases. This makes it a little hard to debug the real cause of the
> failure.
>
> Print some error messages to make it easier for developer to figure out
> what happened.
[]
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
[]
> @@ -1238,17 +1238,26 @@ thermal_zone_device_register(const char *type, int trips, int mask,
> int count;
> struct thermal_governor *governor;
>
> - if (!type || strlen(type) == 0)
> + if (!type || strlen(type) == 0) {
> + pr_err("Error: No thermal zone type defined");

Please use terminating newlines like:

pr_err("Error: No thermal zone type defined\n");

[]
> + pr_err("Error: Thermal zone name (%s) too long, should be under %d chars",

etc...