Re: linux-5.4-rc8/drivers/char/tpm/tpm1-cmd.c:735: possible missing return value check

From: Greg KH
Date: Mon Nov 18 2019 - 04:27:27 EST

On Mon, Nov 18, 2019 at 09:24:32AM +0000, David Binderman wrote:
> Hello there,
> linux-5.4-rc8/drivers/char/tpm/tpm1-cmd.c:735:5: style: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
> Source code is
> if (tpm_suspend_pcr)
> rc = tpm1_pcr_extend(chip, tpm_suspend_pcr, dummy_hash,
> "extending dummy pcr before suspend");
> rc = tpm_buf_init(&buf, TPM_TAG_RQU_COMMAND, TPM_ORD_SAVESTATE);
> Suggest add test of rc after call to tpm1_pcr_extend.

Great, how about you submit a patch to resolve this? That way you can
get the full credit for finding and resolveing the issue?


greg k-h