Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2936948pxb; Thu, 10 Feb 2022 08:41:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdABc2rNTXy0RPdld2TuoBr49I3Cd2NKgMSaQhxOQjjm1IfZAVIz615k1bmh2qUj3+CsWZ X-Received: by 2002:a17:907:6d88:: with SMTP id sb8mr7023510ejc.25.1644511272906; Thu, 10 Feb 2022 08:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644511272; cv=none; d=google.com; s=arc-20160816; b=zbJ+lCOuq9eyPAtRP7Arx51VGZ5v45uDHUEHEPU4bYIykKnquoEAdgIT+N5FFrcjZJ H73yDdp9fcnerQ1ePg3ZzmGhNCf3WNR7xuSz7qbEvNUv3MW6cBbFybK+VXfPulcdRut5 CfhrVXF9lBjQHUlgHhnVoTDvf+TXhmwWCwJoqnzUjw5KQ38DoTO97VskD8a4t7IeW9Oy JKpHxrtZrSx3fKjDuIAGJqxVXmpmQk783pD/dJg6iJnb5WBVK9LYOpUh0vxP8DceKu6u Mkt8sO708eOE3EPLmrtCqOxE4vZ6/k/yETdAYTuhIiH/OIEyn/ejtoHJy5WnbFeiJj7c HmOg== 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=aiRAzVlBFqEzM9q0CzcBtD1ULGhFW87FFO7nBHNihjQ=; b=LzbGdC0TpWlvlXVbyj5yOp7srviFlyt75ncbPUAFonGcaHetsNnm07B+ZwUCefRy7B MGwz3HXDkp/z+CDd75BV93x98MSNwQ9nJaibHX4E2uIH56DagsuA6CeFTNomhs8797Bn q1SyWnz6AHfSA1luVhO2H7Ba1rWK5zw/P1z4AxX1uq0Q4nyH5RMPlbH+4e9+KlN/DL3y dSrC47kyrUugouyyUInjA8/QaxdQ/KiK2+7bahACS1Xe8curdoQczdTBSIr8w3bewL20 y+5LlfF2DfWd53YJZXWKrhtv4x2CVZ+y+i6mT8NMB8UX+XA9zb2nGgX1C0jY8TtV10ro ANpg== 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 24si12725085eje.481.2022.02.10.08.40.46; Thu, 10 Feb 2022 08:41:12 -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 S238384AbiBJJSX (ORCPT + 99 others); Thu, 10 Feb 2022 04:18:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235240AbiBJJSV (ORCPT ); Thu, 10 Feb 2022 04:18:21 -0500 X-Greylist: delayed 1071 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 10 Feb 2022 01:18:22 PST Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1084F5 for ; Thu, 10 Feb 2022 01:18:22 -0800 (PST) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4JvVwG6mpwz1FD5t; Thu, 10 Feb 2022 16:56:14 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 10 Feb 2022 17:00:11 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 10 Feb 2022 17:00:11 +0800 From: Yang Yingliang To: , CC: , Subject: [PATCH -next] tee: optee: fix error return code in probe function Date: Thu, 10 Feb 2022 17:10:53 +0800 Message-ID: <20220210091053.2045809-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500007.china.huawei.com (7.185.36.183) 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,T_SCC_BODY_TEXT_LINE 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 If teedev_open() fails, probe function need return error code. Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/tee/optee/ffa_abi.c | 4 +++- drivers/tee/optee/smc_abi.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c index f2bf6c61197f..f744ab15bf2c 100644 --- a/drivers/tee/optee/ffa_abi.c +++ b/drivers/tee/optee/ffa_abi.c @@ -869,8 +869,10 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) optee_supp_init(&optee->supp); ffa_dev_set_drvdata(ffa_dev, optee); ctx = teedev_open(optee->teedev); - if (IS_ERR(ctx)) + if (IS_ERR(ctx)) { + rc = PTR_ERR(ctx); goto err_rhashtable_free; + } optee->ctx = ctx; rc = optee_notif_init(optee, OPTEE_DEFAULT_MAX_NOTIF_VALUE); if (rc) diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index 1a55339c7072..c517d310249f 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -1417,8 +1417,10 @@ static int optee_probe(struct platform_device *pdev) platform_set_drvdata(pdev, optee); ctx = teedev_open(optee->teedev); - if (IS_ERR(ctx)) + if (IS_ERR(ctx)) { + rc = PTR_ERR(ctx); goto err_supp_uninit; + } optee->ctx = ctx; rc = optee_notif_init(optee, max_notif_value); if (rc) -- 2.25.1