platform/x86/amd/pmf: Ensure mutexes are initialized before use
authorHans de Goede <hdegoede@redhat.com>
Mon, 30 Jan 2023 13:25:54 +0000 (14:25 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 30 Jan 2023 13:30:57 +0000 (14:30 +0100)
commite0c40529ff942a985eb0f3dacf18d35ee4dbb03d
tree3a9900c1c444d93052b4de56325a66e426e3effa
parentf21bf62290dd4d769594dcf0e6a688783d74f6a0
platform/x86/amd/pmf: Ensure mutexes are initialized before use

As soon as the first handler or sysfs file is registered
the mutex may get used.

Move the initialization to before any handler registration /
sysfs file creation.

Likewise move the destruction of the mutex to after all
the de-initialization is done.

Fixes: da5ce22df5fe ("platform/x86/amd/pmf: Add support for PMF core layer")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230130132554.696025-1-hdegoede@redhat.com
drivers/platform/x86/amd/pmf/core.c