Skip to content

Commit

Permalink
thermal: intel: quark_dts: fix error pointer dereference
Browse files Browse the repository at this point in the history
If alloc_soc_dts() fails, then we can just return.  Trying to free
"soc_dts" will lead to an Oops.

Fixes: 8c18769 ("thermal: intel Quark SoC X1000 DTS thermal driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
error27 authored and rafaeljw committed Mar 1, 2023
1 parent 1b72607 commit f1b930e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/thermal/intel/intel_quark_dts_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,22 +400,14 @@ MODULE_DEVICE_TABLE(x86cpu, qrk_thermal_ids);

static int __init intel_quark_thermal_init(void)
{
int err = 0;

if (!x86_match_cpu(qrk_thermal_ids) || !iosf_mbi_available())
return -ENODEV;

soc_dts = alloc_soc_dts();
if (IS_ERR(soc_dts)) {
err = PTR_ERR(soc_dts);
goto err_free;
}
if (IS_ERR(soc_dts))
return PTR_ERR(soc_dts);

return 0;

err_free:
free_soc_dts(soc_dts);
return err;
}

static void __exit intel_quark_thermal_exit(void)
Expand Down

0 comments on commit f1b930e

Please sign in to comment.