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)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 10 Feb 2016 02:12:08 +0000 (04:12 +0200)
commit8e0ee3c9faed7ca68807ea45141775856c438ac0
treeb458057391012211f0a69e22270579f2639d4d7d
parent72c91ce8523ae5828fe5e4417ae0aaab53707a08
tpm: fix the cleanup of struct tpm_chip

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>
drivers/char/tpm/tpm-chip.c