Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp23365pxb; Wed, 30 Mar 2022 21:49:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKEYaG6I1GC8Mwngpr/5mVlvUvp7VPsux+EmnSGATNVjQ/dOfcGavK03OFFyeAPcUS84DQ X-Received: by 2002:a17:90a:ca96:b0:1c6:b478:788e with SMTP id y22-20020a17090aca9600b001c6b478788emr3961812pjt.162.1648702142242; Wed, 30 Mar 2022 21:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648702142; cv=none; d=google.com; s=arc-20160816; b=GE8KYMksWbbtM3lojf9M69Ax7jn2hB7IlWnEBvuFJdgca7OVT6UL3zg5wN/Rzd8Bi/ gXjog7LNLdem5b3DEhGdoC4iFy6rGbC6Pqhm58P4S1c7jTXLosMU78eUxmv8cxTTHm6j w0HtVIIgso+e9gCYHSIjBmBsv1ljorxFuck8fOAbvFAr7pwkYOxPW9FAEFU1sYvSkhdv BHoUVpHNG2kbiNZlJpHdol/924fncVP2UPPQIUFntkbKt00YS8RFrRq4P2dRN8VDda9n LgwO0SEjMu5HXZRHG1g6QRy+jPS3KXEKMWrrccU+MXCDpO/SZCKXqUI3gSkmuPjnXWBD FIAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YsGH86wdhtK1e3FXzisPvt6LwBo/uqirTytiz9tw8Ww=; b=JW2D6y7dn5aO6IFZ2+7ZWJid8+nI1VvjjD6nb+gGkK/dLay2Vwi1ZClF4/JUNqwJiu E700FW5J5tW9CXX0S5W88Z3202eEbecYKJUzmG5QsxOTDgMLWehLzgLpU5blkdb8g5vk 756XYv1Ptn8jzuMsaVdWCoosVLX1szr81xW2idVooGc84+3q0NmbcByfdcmAk5bCO5ez JyB+1IQpCGaXrvtbDEOQvZ10OmOAsLtHVzMvYh53fZZIlpZZHhjXhWjSejw2nBXn1OKG 4BNKrQfGz0UWG9BYLrAIFXaVbdY9Qpk9R8c7jqiXmqMVsNRnVIQjbPY2zLy7R6JtDPM4 KehQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k12-20020a170902c40c00b00153b2d165b3si27884986plk.443.2022.03.30.21.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:49:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D6A171F9FD7; Wed, 30 Mar 2022 20:28:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245522AbiC3PJM (ORCPT + 99 others); Wed, 30 Mar 2022 11:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347861AbiC3PId (ORCPT ); Wed, 30 Mar 2022 11:08:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 340B09F6C0 for ; Wed, 30 Mar 2022 08:06:48 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F1A2D1477; Wed, 30 Mar 2022 08:06:47 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A22343F73B; Wed, 30 Mar 2022 08:06:46 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com Subject: [PATCH 12/22] firmware: arm_scmi: Parse clock_enable_latency conditionally Date: Wed, 30 Mar 2022 16:05:41 +0100 Message-Id: <20220330150551.2573938-13-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220330150551.2573938-1-cristian.marussi@arm.com> References: <20220330150551.2573938-1-cristian.marussi@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The clock_enable_latency field in CLOCK_ATTRIBUTES response message has been added only since SCMI v3.1: use the advertised SCMI Clock protocol version as a proper condition check for parsing it, instead of the bare message length lookup. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 6dd4150b761b..b46b43a99871 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -130,8 +130,8 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph, if (!ret) { attributes = le32_to_cpu(attr->attributes); strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE); - /* Is optional field clock_enable_latency provided ? */ - if (t->rx.len == sizeof(*attr)) + /* clock_enable_latency field is present only since SCMI v3.1 */ + if (PROTOCOL_REV_MAJOR(version) >= 0x2) clk->enable_latency = le32_to_cpu(attr->clock_enable_latency); } -- 2.32.0