]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: Fix initialization of the cdev
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tue, 30 Jun 2015 19:15:31 +0000 (13:15 -0600)
committerPeter Huewe <peterhuewe@gmx.de>
Mon, 13 Jul 2015 21:33:57 +0000 (23:33 +0200)
commit2b4352dc324acddbbbe9f771d2b1be9b9a7edc06
treebcd66fd63ce3ba231baa834380cc55df4c00d631
parentd5a038d9f380aea1b37993149ecaebee63f3d8b2
tpm: Fix initialization of the cdev

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.

Cc: <stable@vger.kernel.org>
Fixes: de6787e9841a ("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>
drivers/char/tpm/tpm-chip.c