]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
char: tpm: fix error return code in tpm_cr50_i2c_tis_recv()
authorZhihao Cheng <chengzhihao1@huawei.com>
Fri, 9 Apr 2021 01:12:01 +0000 (09:12 +0800)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 14 Apr 2021 13:30:30 +0000 (16:30 +0300)
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 3a253caaad11 ("char: tpm: add i2c driver for cr50")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm_tis_i2c_cr50.c

index ec9a65e7887dd5d49ef789e1e27f19374a8d07cd..f19c227d20f485f4151c5b8f7e6cf926eb5474b6 100644 (file)
@@ -483,6 +483,7 @@ static int tpm_cr50_i2c_tis_recv(struct tpm_chip *chip, u8 *buf, size_t buf_len)
        expected = be32_to_cpup((__be32 *)(buf + 2));
        if (expected > buf_len) {
                dev_err(&chip->dev, "Buffer too small to receive i2c data\n");
+               rc = -E2BIG;
                goto out_err;
        }