diff options
author | Daniel Scally <djrscally@gmail.com> | 2021-10-09 00:46:08 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2021-10-11 15:52:58 +0200 |
commit | 0b243c003e11897bd443ae9be4eda76a57ff732a (patch) | |
tree | 9d63808b5d4e1f5a80008fc6e5f49883ac76e028 | |
parent | platform/x86: gigabyte-wmi: add support for B550 AORUS ELITE AX V2 (diff) | |
download | linux-0b243c003e11897bd443ae9be4eda76a57ff732a.tar.xz linux-0b243c003e11897bd443ae9be4eda76a57ff732a.zip |
platform/x86: intel_skl_int3472: Correct null check
The int3472-discrete driver can enter an error path after initialising
int3472->clock.ena_gpio, but before it has registered the clock. This will
cause a NULL pointer dereference, because clkdev_drop() is not null aware.
Instead of guarding the call to skl_int3472_unregister_clock() by checking
for .ena_gpio, check specifically for the presence of the clk_lookup, which
will guarantee clkdev_create() has already been called.
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=214453
Fixes: 7540599a5ef1 ("platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()")
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Link: https://lore.kernel.org/r/20211008224608.415949-1-djrscally@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c index 9fe0a2527e1c..e59d79c7e82f 100644 --- a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c +++ b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c @@ -401,7 +401,7 @@ int skl_int3472_discrete_remove(struct platform_device *pdev) gpiod_remove_lookup_table(&int3472->gpios); - if (int3472->clock.ena_gpio) + if (int3472->clock.cl) skl_int3472_unregister_clock(int3472); gpiod_put(int3472->clock.ena_gpio); |