From patchwork Fri Apr 26 19:15:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 162967 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1107547jan; Fri, 26 Apr 2019 12:15:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ3+eha7vXzCIaQXeQhvJmSJyzNuA9whBW3ClShNIjbvl2CpAix8MHcBX6LMjlPjDvxonP X-Received: by 2002:aa7:9a99:: with SMTP id w25mr26791966pfi.240.1556306125987; Fri, 26 Apr 2019 12:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556306125; cv=none; d=google.com; s=arc-20160816; b=awDs0FJ3EWg26IzZwhboQd6TXewMTwRE19y/Vv3M1yX3KKZaH7XUNOmw0okhGraHb4 0kMEU5UzyNmhN9a+Jq+N0W1QPBQ2T/UzhMDGdb0/oMO1N1gmPcYr/AAG67LLy472CvuG YWahPcm6Y20VgTPl9TWkXOJnyZLv0O3lnTX+Nkb7MbXNMfYxiQlL5hCKjmnSVX53i6Sn WUO8goNQ6SR3UpWtyUFHkk2yL10UHzIzC9b+cDr0/uQktIKVsKK7mRccmGO9+nHsSAO8 s5til7D7Wjx1VKS48jc5ieiF65Mo1sOibMK5Dg49uqFwxmTilsphvnFOOcsDD05ViMOo dkjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=WZ/vAAa0X/NtLjj3yurjTJR/c2NdPPFOeqtxoYjAra4=; b=CmlaNjyzqSA66YS/73dgevCWblmLwvcI3tKtz49Hc4m0dyZJe7FqIXxnu66oqtZXb2 UYCqf238Gv4r7z4HngeHDL72NBHv3Vupy9ZQWR8eqCBfz7LPQ1trMZ0AMWe+mnPJm6S/ 6nQfVdKi7Jume4/sIMGh7GhtQNqRtC9Jqr87u87v3CXTYlVdtFRpdgqGtU96SqEOiTWW Z8mztPu8mgpnRdglCkP4Irfaxfna+2dYDV0JAc2OMm5nnSnLDcraiZ/GuPAMBPMYy1iQ 4Bm0z2tIxSuz5PWac3uRg6jfEi5foymyGnjTZn2Dnt39gh2gBuHQGBz6zTgFJm5Vw6Xq Ix7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e2Jq6NeF; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l189si24521403pgd.291.2019.04.26.12.15.25; Fri, 26 Apr 2019 12:15:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=@linaro.org header.s=google header.b=e2Jq6NeF; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbfDZTPY (ORCPT + 11 others); Fri, 26 Apr 2019 15:15:24 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45641 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbfDZTPY (ORCPT ); Fri, 26 Apr 2019 15:15:24 -0400 Received: by mail-wr1-f67.google.com with SMTP id s15so5783818wra.12 for ; Fri, 26 Apr 2019 12:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WZ/vAAa0X/NtLjj3yurjTJR/c2NdPPFOeqtxoYjAra4=; b=e2Jq6NeFOkrkb5tcKAr86K0ml0paks5BSvSabhnLF0W1JZ7gHdDtZNE+KlHn28doMD 922g01NnvqWh9VTwKH2m0q/gvLtxvCOjKgI6UldT9po5/ISfnoZYWL0YzzwYvEPoEP0l X+7/3RSqRdAVsWKS0P5+x01h48FsIbD5twTeSWjHAtjeWSv3KW+kdewko4TP91oqvv4u Kn0WDeOaXgcxpoLdtQSMxCYL1QtdH7bYMxA64bE75KNysdcr92KqkzjTG9WgFaPkqeST /c+3KLmr3g75wMK/6As1wpBkA/HAGItItZRr9gUr2rPnl06zvpgdwWiJ6dv6TbdOPMBl ZAVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WZ/vAAa0X/NtLjj3yurjTJR/c2NdPPFOeqtxoYjAra4=; b=YYGKZwDw/EVG6ExDnhoPktEHn9v3LLbQPHNS5KqE6F/OFrjyqJLX4Vmji9m/ORfHzu m/0Ok39V4iSv8wsBnG6fXM5cE+Lt0lbxUC8IUE7mFs/1TpWQDIxvue7mv7H2hfNqKuZ7 oSj8H9hPZsgU+z9JHshV5504T770UxxF1NqG8NoPW0UXM9QDiJYtQ0XEDCjTlYF9HB21 S4SJYQ53xoquWYHR2PC28X0vfqKVSrx2SmzgxOzrrRtDn7PSDMos57sKj24+bV/jNZd0 rJq19C3K1RtHgqdI1Fy4yyiXXeVjuEZSTvRbBL28y9aqTGHWJ/z1p4wfq81IrnweF65R R9OQ== X-Gm-Message-State: APjAAAXctr/joJcDL/y49nGihGHd9wGgfX1N0BsoZKSijJUTLdEAPfV6 hQMqfC3k4qEFFwe/Ow2Azj7Z7A== X-Received: by 2002:adf:9c91:: with SMTP id d17mr6841850wre.285.1556306122664; Fri, 26 Apr 2019 12:15:22 -0700 (PDT) Received: from localhost ([49.248.199.210]) by smtp.gmail.com with ESMTPSA id v13sm49730975wrg.46.2019.04.26.12.15.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Apr 2019 12:15:21 -0700 (PDT) From: Amit Kucheria To: linux-kernel@vger.kernel.org, Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org Subject: [PATCH v1] thermal: Add some error messages Date: Sat, 27 Apr 2019 00:45:15 +0530 Message-Id: <640cd0cd93e199459af6d6d04bad228e909faf54.1556305991.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When registering a thermal zone device, we currently return -EINVAL in four cases. This is makes is 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. Signed-off-by: Amit Kucheria --- drivers/thermal/thermal_core.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6590bb5cb688..51cb6d2bf7a2 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1189,17 +1189,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"); return ERR_PTR(-EINVAL); + } - if (type && strlen(type) >= THERMAL_NAME_LENGTH) + if (type && strlen(type) >= THERMAL_NAME_LENGTH) { + pr_err("Error: Thermal zone name (%s) too long, should be under %d chars", + type, THERMAL_NAME_LENGTH); return ERR_PTR(-EINVAL); + } - if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) + if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) { + pr_err("Error: Incorrect number of thermal trips"); return ERR_PTR(-EINVAL); + } - if (!ops) + if (!ops) { + pr_err("Error: Thermal zone device ops not defined"); return ERR_PTR(-EINVAL); + } if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp)) return ERR_PTR(-EINVAL);