OSDN Git Service

tee: optee: fix error return code in probe function
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 10 Feb 2022 09:10:53 +0000 (17:10 +0800)
committerJens Wiklander <jens.wiklander@linaro.org>
Mon, 14 Feb 2022 11:36:48 +0000 (12:36 +0100)
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 <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/optee/ffa_abi.c
drivers/tee/optee/smc_abi.c

index 545f61a..0c90355 100644 (file)
@@ -860,8 +860,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)
index bacd1a1..4157f4b 100644 (file)
@@ -1427,8 +1427,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)