]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tpm: Fix initialization of the cdev
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tue, 30 Jun 2015 19:15:31 +0000 (13:15 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Aug 2015 16:29:11 +0000 (09:29 -0700)
commitf7ea8a3bd52da9670d32fd9869657a8501edff23
tree8ca8ace2a39e938de6eb926542ffeeb20eb8cc80
parent82bebdad67b9d968cf564166a09aab6e7f4e2301
tpm: Fix initialization of the cdev

commit ba0ef85479c46a2ab354c2220bdb6152f7f4baf3 upstream.

When a cdev is contained in a dynamic structure the cdev parent kobj
should be set to the kobj that controls the lifetime of the enclosing
structure. In TPM's case this is the embedded struct device.

Also, cdev_init 0's the whole structure, so all sets must be after,
not before. This fixes module ref counting and cdev.

Fixes: 313d21eeab92 ("tpm: device class for tpm")
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/tpm/tpm-chip.c