On Tue, Oct 18, 2016 at 08:49:42PM -0400, Nayna Jain wrote:
> +     struct tpm_chip_seqops *chip_seqops;
> +     const struct seq_operations *seqops;
> +     struct tpm_chip *chip;
> +
> +     inode_lock(inode);
> +     if (!inode->i_private) {
> +             inode_unlock(inode);
> +             return -ENODEV;
> +     }
> +     chip_seqops = (struct tpm_chip_seqops *)inode->i_private;
> +     seqops = chip_seqops->seqops;
> +     chip = chip_seqops->chip;
> +     get_device(&chip->dev);

The inode_unlock should be here, not further below - reduces the risk of
deadlocking.

> +     rc = read_log(chip);
> +     /*
> +      * read_log failure means event log is not supported except for ENOMEM
> +      */
> +     if (rc < 0) {
> +             if (rc == -ENOMEM)

It would be more consistent to use -ENODEV as indicating no support,
and everything else is pass as an error

Rest looks right to me

Jason

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

Reply via email to