Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3804171ybl; Sun, 8 Dec 2019 23:51:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwwHth1qmyEOLOL11ZSugSOb3NW8zEj5fbyyrfiwpqbKafpGaetE1e9PWnfRS3axTdQD3D1 X-Received: by 2002:a9d:74d8:: with SMTP id a24mr21454221otl.100.1575877885767; Sun, 08 Dec 2019 23:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575877885; cv=none; d=google.com; s=arc-20160816; b=ADp4mp20SG5E4/F/TN59NwERhgVVsTVwxFEwbSnuqLQBldCBZDIGlveoX7KwXX87K5 tleMZxibhwivUhFu/+VvtZtLxGpyE3M74UBVfjqGXD7iEc6b+ryNzS2g2rmYkTJi5nMA OlmbSEyoYv3GVYEi4M97TNIoIfXJjTrp7wt6iiBgmq+qljpUV85cbnhhP5S5gMW3Xjqq 7sahKfc9/5a7KdCZ1KqzHcbtZXUb0uKED37I6MFFxY8k17My9mYgA0YMk8yLKjartpqC twRKbdu3vwAn9qBYqOzhzw7uUDkGBEWwSBAKOhFl87cCNSWeMr+psIyxx8ivzEAV5RNw aOpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8x9z5IK3e1jLIYvYQLpPPPTrSa/xPbdbpcJwZ5RslgE=; b=azrytAru9949S1vySnCohj09/lsx23FP7fxnmadw/Sz8MfS/5jJRzZkYhbOT2Q2DDr yMZkN23Pr2KzaGscWBQxw8IdPHrB5TUyt3ORpL6u0RmbF3F+OlITcRuYLz69A0FGh1eg DtTjzYDzGGDVoNxhI2GDNntTCF7DqLKuc9PB5vDQbQx5Xh+XgF4tBg71s9XWuRnhPexK NexaIG4HVV2Kh/EkZMWREK1zDM7/cBN9rlA4R+65SyHK5oD77X58JQ4KkiaeAVQxoAwB CagjQ7WKvu7evTH7iFM9TWJXZvw2aTVGeG9zDuBcG9lj3AYa6R/MNBE6VLWGD5Iy3h1H woMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=pmn0xhN6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g25si11674353otp.20.2019.12.08.23.51.15; Sun, 08 Dec 2019 23:51:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=pmn0xhN6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbfLIHl6 (ORCPT + 99 others); Mon, 9 Dec 2019 02:41:58 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:39551 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726623AbfLIHl5 (ORCPT ); Mon, 9 Dec 2019 02:41:57 -0500 Received: by mail-vs1-f68.google.com with SMTP id p21so9578447vsq.6 for ; Sun, 08 Dec 2019 23:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8x9z5IK3e1jLIYvYQLpPPPTrSa/xPbdbpcJwZ5RslgE=; b=pmn0xhN6Tb+kX0BCG0uXmcoqG1PzozNOPt10tuMFI22HOYdzAzYOdKDB/plA1snGDK Otsn3JiTjkyuuaBE0ZVIToFtEJRshz9dFzG8Chharzz8YaItxWj/H81zLPoCk/q4Na23 paro+DokcNAtGu+4c6AJk4PUpR8Y0/MCdxV33fFY4CNzPjECPhnt1CyP/uPvFw7zw61D LaY7MKYg41sBBXBYtj7dBgMw1K7/uLnI5TaoO1LLNSiMYJdTBEFwE2KD0CgIEE1+bxbc SKDlhEgDaM8dlQf4fx2ZTaG4vhOMmQHDgJDeeDOZqzt5nOsSc5hoRtMXybBJEuGeWjV2 2uwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8x9z5IK3e1jLIYvYQLpPPPTrSa/xPbdbpcJwZ5RslgE=; b=tVnMBv51Txas6uOEmSAUs8r/MeFGkVK1VuHLLL0J0bRZhqSY3IFa8r/+8AQjDWhFlg Cs77SYGXJImIKo4Gxlp4RZlTUrWf61zBCTOfnw7Xm51F7bz4hjKju9sXFHz1Y6u++Fc8 zTKhHkRyWZ3mu4hkbpyvCEfT88Fj/fyBdBLoOnGAaizXDsabvOSAfKq6GE+TCR3FSKAi PdNKfQGNogvtTlCqNfJMAbgLN8s0hhV26LSW+TaqmQrwCdoiXmkIETaGFCvSUx5jZlM9 /cJqH5GTL170WcjyC7js4Zz93EnIL6QrJWmFNLUU/nwVkF6ynEs3s4N9Kom7S4qsw95u 11vw== X-Gm-Message-State: APjAAAURFxw0crzamwccDgX2lKRx6fkPj+aFmXWmAnW2GTDvHOirMhS8 0/+Vuh1Nf68q9gW/1beKBiX4r3u9TZCyYFqQvY0gor4M+j6O7w== X-Received: by 2002:a67:fb41:: with SMTP id e1mr12561823vsr.159.1575877316661; Sun, 08 Dec 2019 23:41:56 -0800 (PST) MIME-Version: 1.0 References: <20191205071953.121511-1-wvw@google.com> <20191205071953.121511-3-wvw@google.com> In-Reply-To: <20191205071953.121511-3-wvw@google.com> From: Amit Kucheria Date: Mon, 9 Dec 2019 13:11:45 +0530 Message-ID: Subject: Re: [PATCH v3 2/3] thermal: improve error message in thermal zone registration To: Wei Wang Cc: Wei Wang , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Linux PM list , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 5, 2019 at 12:50 PM Wei Wang wrote: > > 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 Reviewed-by: Amit Kucheria > --- > 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 >