Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2006140rwl; Sun, 26 Mar 2023 13:45:54 -0700 (PDT) X-Google-Smtp-Source: AK7set/IJZy3xf6onvuMF0mGosU79ltOEXjCXsF3VNncVhhbDa+CFe+OZt/klnDSHJk2lhXhOtFJ X-Received: by 2002:a17:90b:1a85:b0:23a:66:1d3a with SMTP id ng5-20020a17090b1a8500b0023a00661d3amr10576490pjb.45.1679863554134; Sun, 26 Mar 2023 13:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679863554; cv=none; d=google.com; s=arc-20160816; b=GfofNyYrbaO2uzxfrH5bYL7/mi9Iskqam7BFHeKwRHh+l3mZwpj1ocihW9oIOGj5ja SWozSJ7B60o6rNxSOZLGVFv8Ov83zInAGLIwK4W7P63oS0fDICeC7iPia+hnvnfe+B7t HfrpBgDTbcZQ48qlTEPCSERoPsOrz+T7faQHie3aD8rKJOQyrpwDThJ5GJm7DXq5BR/B 9mUaY+6vxZXn2IXD9/5dLavjIYwpqM5adPusO4QrUYE0NCkUnVKKjRQmZdo9ezq+I2yz w7CFhTXIP2CZbjzVkaIrSOEonaw0KZPTEmrVVM7i8goCf3/Fe98puGMNAU7lF//0qMSo xvSw== 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 :message-id:date:subject:cc:to:from; bh=9UnXlcnGV6L8AptQ0mS7fhbL/exozzQgw20pwEYZrEg=; b=yFsGBTWIYuD4gGFQS1FIk/cHucq+CymP+174dRF11fAXKK16IcPlPZprLSqDYaKqCR CL8CFnmW8Nov1lqsySUutKFHpBDmbT78yC1mgleSJQvCEgUPIOKvUlFN6pSdgAHVCfmD 2lHD7a52JWKRCuDw9MxAC7PmNcaiRvkx3uRu7xKlFexk75HUXvVHw8VlCb4qyG7RBo3T GOgW57YSXJaZ/3qJs5I1hgA59SHI+ufs0iCfnSuABRT+TieHkP9dDMfno4zDSiLQYMwv rU7rDF2dBIWuzG72Xvm6Zo0QMIozEhCarnDedDmWFlsQukN8lR+3lKRfwq6wJD9lsMQ+ QJoQ== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170902d50500b001a216fddcffsi6758475plg.645.2023.03.26.13.45.43; Sun, 26 Mar 2023 13:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbjCZUfW (ORCPT + 99 others); Sun, 26 Mar 2023 16:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjCZUfV (ORCPT ); Sun, 26 Mar 2023 16:35:21 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B0975BB0 for ; Sun, 26 Mar 2023 13:35:20 -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 2DBA0FEC; Sun, 26 Mar 2023 13:36:04 -0700 (PDT) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A9F93F6C4; Sun, 26 Mar 2023 13:35:19 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, cristian.marussi@arm.com Subject: [PATCH] firmware: arm_scmi: Fix xfers allocation on RX channel Date: Sun, 26 Mar 2023 21:34:49 +0100 Message-Id: <20230326203449.3492948-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Two distinct pools of xfer descriptors are allocated at initialization time: one (TX) used to provide xfers to track commands and their replies (or delayed replies) and another (RX) to pick xfers from to be used for processing notifications. Such pools, though, are allocated globally to be used by the whole SCMI instance, they are not allocated per-channel and as such the allocation of notifications xfers cannot be simply skipped if no RX channel was found for the Base protocol common channel, because there could be defined more optional per-protocol dedicated channels that instead support RX channels. Change the conditional check to skip allocation for the notification pool only if no RX channel has been detected on any per-channel protocol at all. Fixes: 4ebd8f6dea81 ("firmware: arm_scmi: Add receive buffer support for notifications") Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 06c56109df38..005e40c3eb32 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2343,7 +2343,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) return ret; ret = __scmi_xfer_info_init(sinfo, &sinfo->tx_minfo); - if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) + if (!ret && !idr_is_empty(&sinfo->rx_idr)) ret = __scmi_xfer_info_init(sinfo, &sinfo->rx_minfo); return ret; -- 2.34.1