Commit 10d4879f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'thermal-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control fixes from Rafael Wysocki:
 "Fix two issues introduced recently and one driver problem leading to a
  NULL pointer dereference in some cases.

  Specifics:

   - Add missing EXPORT_SYMBOL_GPL in the thermal core and add back the
     required 'trips' property to the thermal zone DT bindings (Daniel
     Lezcano)

   - Prevent the int340x_thermal driver from crashing when a package
     with a buffer of 0 length is returned by an ACPI control method
     evaluated by it (Lee, Chun-Yi)"

* tag 'thermal-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
  dt-bindings: thermal: Fix missing required property
  thermal/core: Add missing EXPORT_SYMBOL_GPL
parents b98f602d 3bf1b157
...@@ -214,6 +214,7 @@ patternProperties: ...@@ -214,6 +214,7 @@ patternProperties:
- polling-delay - polling-delay
- polling-delay-passive - polling-delay-passive
- thermal-sensors - thermal-sensors
- trips
additionalProperties: false additionalProperties: false
......
...@@ -527,7 +527,7 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) ...@@ -527,7 +527,7 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv)
priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer, priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer,
obj->package.elements[0].buffer.length, obj->package.elements[0].buffer.length,
GFP_KERNEL); GFP_KERNEL);
if (!priv->data_vault) if (ZERO_OR_NULL_PTR(priv->data_vault))
goto out_free; goto out_free;
bin_attr_data_vault.private = priv->data_vault; bin_attr_data_vault.private = priv->data_vault;
...@@ -597,7 +597,7 @@ static int int3400_thermal_probe(struct platform_device *pdev) ...@@ -597,7 +597,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
goto free_imok; goto free_imok;
} }
if (priv->data_vault) { if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
result = sysfs_create_group(&pdev->dev.kobj, result = sysfs_create_group(&pdev->dev.kobj,
&data_attribute_group); &data_attribute_group);
if (result) if (result)
...@@ -615,6 +615,7 @@ static int int3400_thermal_probe(struct platform_device *pdev) ...@@ -615,6 +615,7 @@ static int int3400_thermal_probe(struct platform_device *pdev)
free_sysfs: free_sysfs:
cleanup_odvp(priv); cleanup_odvp(priv);
if (priv->data_vault) { if (priv->data_vault) {
if (!ZERO_OR_NULL_PTR(priv->data_vault))
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
kfree(priv->data_vault); kfree(priv->data_vault);
} }
...@@ -647,7 +648,7 @@ static int int3400_thermal_remove(struct platform_device *pdev) ...@@ -647,7 +648,7 @@ static int int3400_thermal_remove(struct platform_device *pdev)
if (!priv->rel_misc_dev_res) if (!priv->rel_misc_dev_res)
acpi_thermal_rel_misc_device_remove(priv->adev->handle); acpi_thermal_rel_misc_device_remove(priv->adev->handle);
if (priv->data_vault) if (!ZERO_OR_NULL_PTR(priv->data_vault))
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
......
...@@ -1329,6 +1329,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t ...@@ -1329,6 +1329,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
kfree(tz); kfree(tz);
return ERR_PTR(result); return ERR_PTR(result);
} }
EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips);
struct thermal_zone_device *thermal_zone_device_register(const char *type, int ntrips, int mask, struct thermal_zone_device *thermal_zone_device_register(const char *type, int ntrips, int mask,
void *devdata, struct thermal_zone_device_ops *ops, void *devdata, struct thermal_zone_device_ops *ops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment