Skip to contentSkip to conversation

thermal: ti-soc-thermal: Fix the return value in ti_bandgap_get_sensor_data() kernel-doc

PATCH Applied Karl Mehltretter 3 participants 3 messages Sep 12 – Oct 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: ti-soc-thermal: Fix the return value in ti_bandgap_get_sensor_data() kernel-doc

ti_bandgap_get_sensor_data() returns an ERR_PTR() if the bandgap instance or sensor ID is invalid. Otherwise it returns the stored sensor data, which can be NULL if no data has been set or the stored value has been cleared.

This mismatch was already present in omap_bandgap_get_sensor_data() when the driver was introduced in staging.

Document the validation errors while retaining NULL as a possible stored value.

Fixes 8feaf0ce1a04 ("staging: OMAP4+: thermal: introduce bandgap temperature sensor")
Assisted-by LLM
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -1
index ba43399d0b384cf86d12642cc184c5f14066f431..2e8fe7daedb80b7ca4a24f2c89fc5ef44a0a9ebb 100644
@@ -576,7 +576,8 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data)
  * @bgp: pointer to bandgap instance
  * @id: sensor id
  *
- * Return: data stored by set function with sensor id on success or NULL
+ * Return: the stored sensor data, which may be %NULL, or an ERR_PTR()
+ * if @bgp or @id is invalid.
  */
 void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id)
 {
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw
Quoted 8 lines · Karl Mehltretter

ti_bandgap_get_sensor_data() returns an ERR_PTR() if the bandgap instance or sensor ID is invalid. Otherwise it returns the stored sensor data, which can be NULL if no data has been set or the stored value has been cleared.

This mismatch was already present in omap_bandgap_get_sensor_data() when the driver was introduced in staging.

Quoted 7 lines

Document the validation errors while retaining NULL as a possible stored value.

Fixes 8feaf0ce1a04 ("staging: OMAP4+: thermal: introduce bandgap temperature sensor")
Assisted-by LLM

---

Applied, thanks

#2 lore raw
In reply to Karl Mehltretter
The following commit has been merged into the thermal/linux-next branch of thermal:

The following commit has been merged into the thermal/linux-next branch of thermal:

Commit-ID:     82bb005cd9cf5a9df4cfe4a52db90346ac5fd17a
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//82bb005cd9cf5a9df4cfe4a52db90346ac5fd17a
Author:        Karl Mehltretter <[email protected]>
AuthorDate:    Sat, 12 Sep 2026 08:22:52 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 14 Oct 2026 09:45:41 +02:00

thermal: ti-soc-thermal: Fix the return value in ti_bandgap_get_sensor_data() kernel-doc

ti_bandgap_get_sensor_data() returns an ERR_PTR() if the bandgap instance or sensor ID is invalid. Otherwise it returns the stored sensor data, which can be NULL if no data has been set or the stored value has been cleared.

This mismatch was already present in omap_bandgap_get_sensor_data() when the driver was introduced in staging.

Document the validation errors while retaining NULL as a possible stored value.

Fixes 8feaf0ce1a04 ("staging: OMAP4+: thermal: introduce bandgap temperature sensor")
Assisted-by LLM
---
 drivers/thermal/ti-soc-thermal/ti-bandgap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -1
index 507fe67..815ca07 100644
@@ -576,7 +576,8 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data)
  * @bgp: pointer to bandgap instance
  * @id: sensor id
  *
- * Return: data stored by set function with sensor id on success or NULL
+ * Return: the stored sensor data, which may be %NULL, or an ERR_PTR()
+ * if @bgp or @id is invalid.
  */
 void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id)
 {