Skip to content

Commit

Permalink
tpm_tis: extra chip->ops check on error path in tpm_tis_core_init
Browse files Browse the repository at this point in the history
Found by smatch:
drivers/char/tpm/tpm_tis_core.c:1088 tpm_tis_core_init() warn:
 variable dereferenced before check 'chip->ops' (see line 979)

'chip->ops' is assigned in the beginning of function
in tpmm_chip_alloc->tpm_chip_alloc
and is used before first possible goto to error path.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
  • Loading branch information
Vasily Averin authored and Jarkko Sakkinen committed Jul 2, 2020
1 parent eac9347 commit ccf6fb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/tpm/tpm_tis_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,

return 0;
out_err:
if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, false);

tpm_tis_remove(chip);
Expand Down

0 comments on commit ccf6fb8

Please sign in to comment.