From patchwork Fri Apr 6 15:30:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 132929 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp927489ljb; Fri, 6 Apr 2018 08:31:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48toYLNzq6hm6w6A9McZVPIQGrfFnEqNrorvJWahKJqYLXfXNePmRNtPH/wmuWlxjYU4pu/ X-Received: by 10.98.144.205 with SMTP id q74mr20827312pfk.55.1523028661954; Fri, 06 Apr 2018 08:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523028661; cv=none; d=google.com; s=arc-20160816; b=puf7nRjvV6I+LZzKdLaBIOmg7G88X56VtbH4AHy/QyXLA0Ni4uZk+ahOVjfiAmlRQF txaIajLTQcuM/cupw218mKr7d/MdHelwVnXsTghRpyIIngqrtTl/fgX1ThBcwKX2ffmr FLnVRM99QXdIE6sR6wDz9tOTsYxpTtgHjVi6gj3zgoC32sXBFz3mTLOHCXQXPGsCg5mc Opdp2XJF+G2DhbXFzfFI/mz10YlAEpbiJ9VluoKlpm8Hy7WyLtz1KiHVu99bm+J/nAEp m1L3sex/HhzlwwuA1sB8+pEnLUjQxyQkODR8usXy7QyxHL+Pz66fBXKUIUDN+5HaW9bk aamw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=s5NO3PqD6na3DI4UhszHWiKWNNyqrR9mXc9XNIrcLsw=; b=J3okcMt0OwnAK3eMHr6klAs8Mmv9/P9Uxd55za6IHAadQhQ6R0xVKplBidCmU8fcNa ireXzsdbkenrdqptGN7SKCT4kfhDCV3Qg9whpvL2YUairyOOEX0SQWFK/eyhQRPaAEzN 5LnoFgNEwjbpljXO0OOYYRp7Lj+6CessBlowLCVt+N3nAIn5w/eM8xnDx/jnBEov4fHU hZdwwUcEijdCtBoiNXQs88jt9wT6DkW8z1Ek1N1uHo9fyJzwwb7+F3naJYkxr0w2LzKM GGBjxUADy7nDj0T/tmEFodFYnojm9r/Z6X9oZT2yuPJ0EqfZNWzgJrYselVgfp5wzvjW Zinw== ARC-Authentication-Results: i=1; mx.google.com; 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 f34-v6si8804641ple.622.2018.04.06.08.31.01; Fri, 06 Apr 2018 08:31:01 -0700 (PDT) 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; 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 S1753983AbeDFPa7 (ORCPT + 29 others); Fri, 6 Apr 2018 11:30:59 -0400 Received: from foss.arm.com ([217.140.101.70]:38920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752197AbeDFPay (ORCPT ); Fri, 6 Apr 2018 11:30:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95CDF1529; Fri, 6 Apr 2018 08:30:54 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 878863F587; Fri, 6 Apr 2018 08:30:53 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Guenter Roeck Cc: Sudeep Holla , Jim Quinlan , linux-hwmon@vger.kernel.org Subject: [PATCH] hwmon: (scmi) handle absence of few types of sensors Date: Fri, 6 Apr 2018 16:30:47 +0100 Message-Id: <1523028647-21849-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the loop checks for non-zero count of sensors for each type of sensors which is completely wrong. It also results in aborting the registration of sensors if one or more types of sensors are completely not supported by the platform SCMI firmware. This patch fixes the issue by continue to loop and skiping sensor types that are not present. Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI") Reported-by: Jim Quinlan Cc: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/hwmon/scmi-hwmon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 363bf56eb0f2..91976b6ca300 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -170,7 +170,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) scmi_chip_info.info = ptr_scmi_ci; chip_info = &scmi_chip_info; - for (type = 0; type < hwmon_max && nr_count[type]; type++) { + for (type = 0; type < hwmon_max; type++) { + if (!nr_count[type]) + continue; + scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], type, hwmon_attributes[type]); *ptr_scmi_ci++ = scmi_hwmon_chan++;