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: 313d21ee ("tpm: device class for tpm") Signed-off-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: NPeter Huewe <peterhuewe@gmx.de>
Showing
想要评论请 注册 或 登录