]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tpm: remove superfluous check in tpm_tis_send()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 11 Nov 2023 00:35:30 +0000 (01:35 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 22 Nov 2023 08:03:55 +0000 (10:03 +0200)
Checking if variable chip is NULL after dereferencing it makes no sense.
As discribed in [1] it is not expected that the variable can ever be NULL.

[1] Re: [PATCH] tpm: avoid NULL pointer dereference in tpm_tis_send()
    https://lore.kernel.org/u-boot/YaFwDtKKYRr7qzWc@apalos.home/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
drivers/tpm/tpm2_tis_core.c

index 985a816219867921d7db971c3bb004434c9b4d22..81b9210056db962100d6ecdccb81901280a8462c 100644 (file)
@@ -224,9 +224,6 @@ int tpm_tis_send(struct udevice *dev, const u8 *buf, size_t len)
        u8 status;
        int ret;
 
-       if (!chip)
-               return -ENODEV;
-
        ret = tpm_tis_request_locality(dev, 0);
        if (ret < 0)
                return -EBUSY;