Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp11595pxb; Wed, 30 Mar 2022 21:21:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6HlaGfSzzgbqH2OIqL8czUrLZNb+qWqseTVTJ26msE7kHDVHrhBUNU11v9PJ0YRlCv/h8 X-Received: by 2002:a63:2003:0:b0:381:2dd3:ab4b with SMTP id g3-20020a632003000000b003812dd3ab4bmr9380011pgg.517.1648700504135; Wed, 30 Mar 2022 21:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648700504; cv=none; d=google.com; s=arc-20160816; b=AbVxiezUJ/C/7+84yfMLmTS/yjHcTM2tcYh2nCiYznUfMNJ/fV6NKDc3tWeH5Ss0eV oRSOKCCB+lJ9sES0zwkpOjM7ZBXwKASfOSGQQ/UR8ysU/h6XG/axkD1T874SJz+9c2+O DiReb9xjec38i/RqYp/T2uBl+055uZjfQwcldg8hkCg7a3/DUufK94ShdHTZabapOy9Q Aeda1QDQNMGPvlEGwx1LnvLCfuPyVGXcaea+fLYcO1brEplg7V0CN+3TI7bJqKZPIbiO u1XPRLDocYzDMLpRtswDwwyG3pX3DYbR37jaM7OnFJcKMqEwjDgVyJgNwm550movYznV nQag== 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=oZ53lmXcYwCyPx+a4EVS+RHJDD6L9dfq3Xi6EKRu5cY=; b=w2pjRXaj823N0GQix8eMyfgskLCjgphHO7jAoB9WZg98BMoBLFMRtaAEuZ7p7IvqSq wNDOkv/wvoYpHyfefui4QnA1DMlE6YZQETPqTsjZNpzpB4SjedjPPlOEAtfDqOTB1uu/ QebtwSxKKqpWEoWuR98iYfiA2KAEIMm1XR5/ltMZ3q8AnaGCrBHdqR0e/4MY/vhfrnU+ /DqPdB2IZMvHZSWYGt2641YYEn1D2cQntRUnPTFkDCgLbpAtACXuPf2Y527/G4cj3iSn NlIKNZegmLBq6wlUZ+6FKbWGnWM/09C9GN5wM/OqhjfSXnazU6sig5EayE+hufgpK+5N xagg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d38-20020a631d26000000b0038217a788ccsi22661014pgd.173.2022.03.30.21.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:21:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05DEF19C82B; Wed, 30 Mar 2022 20:17:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347834AbiC3PIV (ORCPT + 99 others); Wed, 30 Mar 2022 11:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347795AbiC3PIQ (ORCPT ); Wed, 30 Mar 2022 11:08:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C102199684 for ; Wed, 30 Mar 2022 08:06:30 -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 86E0B1477; Wed, 30 Mar 2022 08:06:30 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39D0D3F73B; Wed, 30 Mar 2022 08:06:29 -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 01/22] firmware: arm_scmi: Fix sorting of retrieved clock rates Date: Wed, 30 Mar 2022 16:05:30 +0100 Message-Id: <20220330150551.2573938-2-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 During SCMI Clock protocol initialization, after having retrieved from the SCMI platform all the available discrete rates for a specific clock, the clock rates array is sorted, unfortunately using a pointer to its end as a base instead of its start, so that sorting does not work. Fix invocation of sort() passing as base a pointer to the start of the retrieved clock rates array. Fixes: dccec73de91 ("firmware: arm_scmi: Keep the discrete clock rates sorted") Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index cf6fed6dec77..ef6431c6eb1c 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -210,7 +210,8 @@ scmi_clock_describe_rates_get(const struct scmi_protocol_handle *ph, u32 clk_id, if (rate_discrete && rate) { clk->list.num_rates = tot_rate_cnt; - sort(rate, tot_rate_cnt, sizeof(*rate), rate_cmp_func, NULL); + sort(clk->list.rates, tot_rate_cnt, sizeof(*rate), + rate_cmp_func, NULL); } clk->rate_discrete = rate_discrete; -- 2.32.0