Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5990904pxb; Mon, 14 Feb 2022 12:33:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0Z3AjTN28Zu6PXFYA9FC0/Vp6pVqL6FVpIYIK70GWQGVGaN+XzMH6lZ9iy6KcCxIcgcRK X-Received: by 2002:a17:90a:f308:: with SMTP id ca8mr431858pjb.222.1644870799936; Mon, 14 Feb 2022 12:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644870799; cv=none; d=google.com; s=arc-20160816; b=nhTFOCxuFspWHadIeKjp1S2NgICls2um0n6I6vEfD/DkVb5qdMacmBmPmh2VCZPFww IoZS+z30N+ZsFXiwtspXl0y9riKz8t6Gb4ZVKMbo1hsatQ+p0dqk6cV+PJQy6WvBMLVh WUW5/AH3AyhAg/LADM7feBC9hX+4NqXm/Wn9sTpSb6mVYJ10JmcqQtS8XlQj+ym0NIVN Raymnn2wcBbDP3FmwcsjFN1guTBDLyfbpY/V60O7rmGf7LYcjkt/kzecUJXDhKdsk52e +tiqmx1EcBMTr0OkavelrASLZcSdgl1yk0jU5NVPWmJh5hliDyA+zC1YshcVfWaLwReR pzaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ACeEDhjbHou3oxxSi+z3/EFjDqtxOJyqeUY/TfA+geY=; b=Ru3cFty1qoBfDsw12mF6EBVB0kX2+2j9Vkv0ttLXCFJEBVtmTJ4trBOgr2hRgj7KTt 3vD2tQF1NOxX79cJd82tyPpIlw9UxWUq5XodkAFNDlVfSYggKtyl4Mt2W2+VjfWlJX9U tWQOHqjmSzaw4U5NNcZIlObnUDYgoboZ5dBS6O15khI3fsu3gl34BZBMLKadkTX4w2/o yZZtFr0hRLujGxuFAuk7qPbDp6UbsYW8HQqKr7I95w9uCLbozSoMNjzA+Zkn1ICuBWqi dnJt1sybirvamUQKFAyaUKD17PQ7T82QFzjBMmDX+iWcNTYXWJmgSSZqxcn4i2Y14KXI eXYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=maJJV4uu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s14si7827346plg.620.2022.02.14.12.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:33:19 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=maJJV4uu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8BF4419B6FA; Mon, 14 Feb 2022 12:03:08 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351828AbiBNLuU (ORCPT + 99 others); Mon, 14 Feb 2022 06:50:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351877AbiBNLuM (ORCPT ); Mon, 14 Feb 2022 06:50:12 -0500 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE48C5B for ; Mon, 14 Feb 2022 03:48:16 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id i6so26870283pfc.9 for ; Mon, 14 Feb 2022 03:48:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ACeEDhjbHou3oxxSi+z3/EFjDqtxOJyqeUY/TfA+geY=; b=maJJV4uuDmViELDnZ8rGFDbSt54X8jw9p/lpD+DvonMOEbQn4ISNEYpBPzV42bHC3R q/Ue1reO9qQhC7MLSbhEnrgprt/+Q5gnnjd6iiOnXD8ME/hGJ87Tzffnz8zdPUp3jfLH CF6DbvM7DWmhiqP23YjVssFf1+rLmzWGlb+iVC9iAFuXWhMQQXBnhdq9ZA1iKXIzQoAp o4GlgqcJP+lmjx4j5h0Fgav7G/E/ylF1Q+Uc7nMOX9VJsuChmtz79ERir3C44pD92uHO IqLmJypWwIBfaiIFCdHIbLfay2A/x2sKQcl8LOZOfjfDqk4BZWGbJmVqxw2Hce62iwpb rlWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ACeEDhjbHou3oxxSi+z3/EFjDqtxOJyqeUY/TfA+geY=; b=bny+n/Vi5e4tSff3Jkq4R++5RdcGkKqS5jRcUb7pNzlDEI3vfuzpmI0HGcljpxXlnK UGQTFy/DVB3gxLkH25kM1S3xrOegEE2MNWOcchkk9GLM9lBWfh4d1kilsrn9Zkr3+eOC +fgzXOJqE+evCxW8DZvVC6HiCs3JR39hkvqFkANn5U9eCtMjWmBK8miXvU7Hmjcy/kK4 hNIjkpYD+pP+eteLjmlWi3VEoK/i/zlNhRFIELLO4lWgGrQVl775XbmEpJ2KbAgWPg4k Ux4+uTtwwbhJ290jcho2d6+AyGvATZjabRcG83j5MawDjumQV/zBwoBZ0/Pu88Epo9+2 dowA== X-Gm-Message-State: AOAM531PLfDNK2LkjZog8eeVMw3WgCNJT7jGhZk7ouplX35XYQJ/FDO7 LT7HY0v6sfMKm9Sa7oWFNfBtJVZnP8rxsP0BnsPalw== X-Received: by 2002:a05:6a00:1682:: with SMTP id k2mr14191457pfc.69.1644839296340; Mon, 14 Feb 2022 03:48:16 -0800 (PST) MIME-Version: 1.0 References: <20220210091053.2045809-1-yangyingliang@huawei.com> In-Reply-To: <20220210091053.2045809-1-yangyingliang@huawei.com> From: Jens Wiklander Date: Mon, 14 Feb 2022 12:48:05 +0100 Message-ID: Subject: Re: [PATCH -next] tee: optee: fix error return code in probe function To: Yang Yingliang Cc: linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, sumit.garg@linaro.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 On Thu, Feb 10, 2022 at 10:00 AM Yang Yingliang wrote: > > 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(-) Well spotted, I'm picking up this. Thanks, Jens > > 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 >