tpm: fix the cleanup of struct tpm_chip
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 8 Feb 2016 20:31:08 +0000 (22:31 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Mon, 11 Jul 2016 03:06:55 +0000 (23:06 -0400)
commiteae5f796a5de5ebc33e745126ce232f534fd0d0e
tree370a9755e45cefce059d1ba1ec5664cfdff1cf7f
parent03e046efdbd3bccaac952553065adb70fb6976aa
tpm: fix the cleanup of struct tpm_chip

[ Upstream commit 8e0ee3c9faed7ca68807ea45141775856c438ac0 ]

If the initialization fails before tpm_chip_register(), put_device()
will be not called, which causes release callback not to be called.
This patch fixes the issue by adding put_device() to devres list of
the parent device.

Fixes: 313d21eeab ("tpm: device class for tpm")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
cc: stable@vger.kernel.org
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/char/tpm/tpm-chip.c