Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1440139rwb; Wed, 9 Nov 2022 18:27:50 -0800 (PST) X-Google-Smtp-Source: AMsMyM6d9kwqjHGOjfM0cjaHB+KOfikOtw7ZQy37vierzrByr64V6r/7FpFsKyZsHomWNT410+PT X-Received: by 2002:a17:907:7f16:b0:7ad:bf79:f9b6 with SMTP id qf22-20020a1709077f1600b007adbf79f9b6mr54938341ejc.61.1668047269775; Wed, 09 Nov 2022 18:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668047269; cv=none; d=google.com; s=arc-20160816; b=NnnML5tQhkwN4/ek1b0hipM7ShIjIiyh5Jf8ypObnuuL+TrBHGFAcBY4lc9uhcHAtU rJrWdwybDjTR//ZXi5AGFAX+ZkUO977g20PQMstOwDItmhxIIQNHfIRkwzKjJJdAmC42 doWtMOUk7BzLpmv3FnlEoGSiPQJTITB864yQ1bPYERAEJRe7fJUI/x0XooXO5WlD1uYn jgEHROKBBoNDkdJ1H347Ptb4auVjCD2NtbNS1/kX+8Hbex0nB7p8Q0cLb91qpDDBG2Xm vGuDlYXKFtyevVOstNfWiD817p2VFRzrQfUDuafrihbMur0NPQ2/rn+4MCUi/vtpm1Mf 8vEA== 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=K0XdXqbqnX07GQiyNVYevlvuJHQS/aEz3KuFo5AcalU=; b=KET2Ud3Ra1rba/yF3ymrOO/foRPmQ/i6ukgUcppbNtFN0dw/uekVaUxvPRQtJRdUfg by76KKCx1eJEKe2hmRGLslcK8c3bBeaOR33yyQGdWX2GVyxWPzHfDydcC2zW/yilS8LS FMerw2y2riKOQmgsW6L5qBeIFdrVUcGPI0i0MaFqqmHmgc5QboLuPAzRzgSQ0d6KlgOR VYrqLixg4wemO32fitJEnSbk7jdWVc8x3rUdep9wVxnKsfN3SYuc3/ue2BnIAnQAEX8w OWaNO7+fWpOWHeAlH936YrnFbOfjnd+vnz5KIU7KVzNYSPpuFmCOMM2ssYbq6bsFhjtd 7MkA== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a17090603d200b00791a2a7e578si12452526eja.641.2022.11.09.18.27.27; Wed, 09 Nov 2022 18:27:49 -0800 (PST) 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232322AbiKJBw7 (ORCPT + 92 others); Wed, 9 Nov 2022 20:52:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232142AbiKJBwu (ORCPT ); Wed, 9 Nov 2022 20:52:50 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136ADBC85; Wed, 9 Nov 2022 17:52:50 -0800 (PST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4N74XB2WGqzJnZL; Thu, 10 Nov 2022 09:49:46 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 09:52:48 +0800 Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 10 Nov 2022 09:52:47 +0800 From: Huisong Li To: , CC: , , , , , , , , , , , Subject: [PATCH 3/3] mailbox: pcc: fix 'pcc_chan_count' when fail to initialize PCC Date: Thu, 10 Nov 2022 09:50:34 +0800 Message-ID: <20221110015034.7943-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20221110015034.7943-1-lihuisong@huawei.com> References: <20221110015034.7943-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Currently, 'pcc_chan_count' is a non-zero value if PCC subspaces are parsed successfully and subsequent processes is failure during initializing PCC process. This may cause that pcc_mbox_request_channel() can still be executed successfully , which will misleads the caller that this channel is available. Fixes: ce028702ddbc ("mailbox: pcc: Move bulk of PCCT parsing into pcc_mbox_probe") Signed-off-by: Huisong Li --- drivers/mailbox/pcc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 7cee37dd3b73..47d70c5884e3 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -294,6 +294,7 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id) pr_err("Channel not found for idx: %d\n", subspace_id); return ERR_PTR(-EBUSY); } + dev = chan->mbox->dev; spin_lock_irqsave(&chan->lock, flags); @@ -735,7 +736,8 @@ static int __init pcc_init(void) if (ret) { pr_debug("ACPI PCC probe failed.\n"); - return -ENODEV; + ret = -ENODEV; + goto out; } pcc_pdev = platform_create_bundle(&pcc_mbox_driver, @@ -743,10 +745,13 @@ static int __init pcc_init(void) if (IS_ERR(pcc_pdev)) { pr_debug("Err creating PCC platform bundle\n"); - return PTR_ERR(pcc_pdev); + ret = PTR_ERR(pcc_pdev); + goto out; } - return 0; +out: + pcc_chan_count = 0; + return ret; } /* -- 2.22.0