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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:08:47 +0000 (09:08 -0700)
commit158c0029a8861591d42c6ad144d09cbd2c2dfe81
tree718a1e827a89e44cfc02db38b150c5eb3de2be6b
parent062c8a4ff40fedf82c1ec177a63b06c41801c2e9
tpm: fix the cleanup of struct tpm_chip

commit 8e0ee3c9faed7ca68807ea45141775856c438ac0 upstream.

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>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm-chip.c