From patchwork Fri Oct 28 14:08:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp859588wru; Fri, 28 Oct 2022 07:20:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J2Mna0SCkPb+QEyQHjwG+Phx9hI7uIbEh5+NW5b6A5qrba4XRDKjN73Xx0+yNtfRb6uOA X-Received: by 2002:a17:902:e84a:b0:186:b8ff:c698 with SMTP id t10-20020a170902e84a00b00186b8ffc698mr22902831plg.143.1666966851226; Fri, 28 Oct 2022 07:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666966851; cv=none; d=google.com; s=arc-20160816; b=WjR0qd93oGAdZcc8MFU1ZAWlNyIoh+v+IQzxPLeWN8+hj39PRbdgVgVAvBf5ZECw1a tjqclXOdBHJ0ocnroLLg8Bu5yUzCEFWhkO6FPCfIlnthbACSZ9+00A9Gi7fQ6HSPew0b uEsfsmcL2lG5BcTaG5z+zm4maxH16jIZyainWIyW2lhNXLJ1DrAwNvFETCNFbnxxLvzt q+g3Mzp1WVoSXxSD27QMS1ISbnSb7mb6Jx9Mt/Ml7l1K/JgXcP9C295oD/v9IjeujolA KpxT10QL5mNJsnluiFK1POrxMFmiDmKDoeICjDjKewENGj/PYiaDZxmlyO4TRzTmCXsj liNw== 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=T1Zq9JQTBh6vIyiHO9Xsg8XnRRH5I+cp3Hcbqj0r9yk=; b=DEczIZRn9MrK6AjfHfgrpTkuXJa9vAip39kgiMIgJToMRcuvaZc49gWiIcwxW1Pdon sU18VUjqiM5HmvO3BjKnCeEn6n1nAxsRhuJ7uICnhqlY5wRjC3YK23NDdhTNSh8qV+W+ Ac4USD2nhwxz6FhYO0RZJl7Y29Aiafx7fVRm7oCXhQUDUCagcwqgvn1/M/SuoRhmlTRb nbxx3hF6SeR5v491/Jk+0leF9e6gVHt8OTS5wyjr/2HranXTwCUXw2lNqbaMBseELHri t/25U3M3vJHCGdUm+y+yKD6E4cbhmUHdoH/S1VtnBWMNL2FYMLLTC2/zgXr3wQ+Y17aW tNsQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a170902f54a00b00186b6a32284si6145584plf.548.2022.10.28.07.20.37; Fri, 28 Oct 2022 07:20:51 -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 S231485AbiJ1OJR (ORCPT + 99 others); Fri, 28 Oct 2022 10:09:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiJ1OJJ (ORCPT ); Fri, 28 Oct 2022 10:09:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1EC7E1E047C for ; Fri, 28 Oct 2022 07:09:08 -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 2C6401042; Fri, 28 Oct 2022 07:09:14 -0700 (PDT) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 312013F534; Fri, 28 Oct 2022 07:09:07 -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 4/8] firmware: arm_scmi: Make RX chan_setup fail on memory errors Date: Fri, 28 Oct 2022 15:08:29 +0100 Message-Id: <20221028140833.280091-4-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028140833.280091-1-cristian.marussi@arm.com> References: <20221028140833.280091-1-cristian.marussi@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747941432856079587?= X-GMAIL-MSGID: =?utf-8?q?1747941432856079587?= SCMI RX channels are optional and they can fail to be setup when not present but anyway channels setup routines must bail-out on memory errors. Make channels setup, and related probing, fail when memory errors are reported on RX channels. Fixes: 5c8a47a5a91d ("firmware: arm_scmi: Make scmi core independent of the transport type") Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 985775f210f9..f818d00bb2c6 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2045,8 +2045,12 @@ scmi_txrx_setup(struct scmi_info *info, struct device *dev, int prot_id) { int ret = scmi_chan_setup(info, dev, prot_id, true); - if (!ret) /* Rx is optional, hence no error check */ - scmi_chan_setup(info, dev, prot_id, false); + if (!ret) { + /* Rx is optional, report only memory errors */ + ret = scmi_chan_setup(info, dev, prot_id, false); + if (ret && ret != -ENOMEM) + ret = 0; + } return ret; }