* [PATCH 0/2] Thermal/int340x: _art and _trt fixes
@ 2014-12-09 2:01 Ilkka Koskinen
2014-12-09 2:01 ` [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call Ilkka Koskinen
2014-12-09 2:01 ` [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing Ilkka Koskinen
0 siblings, 2 replies; 6+ messages in thread
From: Ilkka Koskinen @ 2014-12-09 2:01 UTC (permalink / raw)
To: linux-pm; +Cc: ilkka.koskinen, rui.zhang, edubezval, jacob.jun.pan
This patch set fixes two issues in parsing _art and _trt acpi entries
Ilkka Koskinen (2):
Thermal/int340x: Clear the error value of the last
acpi_bus_get_device() call
Thermal/int340x: Handle properly the case when _trt or _art acpi entry
is missing
drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call
2014-12-09 2:01 [PATCH 0/2] Thermal/int340x: _art and _trt fixes Ilkka Koskinen
@ 2014-12-09 2:01 ` Ilkka Koskinen
2014-12-09 3:48 ` Zhang Rui
2014-12-09 2:01 ` [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing Ilkka Koskinen
1 sibling, 1 reply; 6+ messages in thread
From: Ilkka Koskinen @ 2014-12-09 2:01 UTC (permalink / raw)
To: linux-pm; +Cc: ilkka.koskinen, rui.zhang, edubezval, jacob.jun.pan
Previously the return value of the last acpi_bus_get_device() was
returned. However, since we only report those issues, it should be
cleared to continue as expected.
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
index ac5c405..e4e61b3 100644
--- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
@@ -131,6 +131,8 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
pr_warn("Failed to get target ACPI device\n");
}
+ result = 0;
+
*trtp = trts;
/* don't count bad entries */
*trt_count -= nr_bad_entries;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing
2014-12-09 2:01 [PATCH 0/2] Thermal/int340x: _art and _trt fixes Ilkka Koskinen
2014-12-09 2:01 ` [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call Ilkka Koskinen
@ 2014-12-09 2:01 ` Ilkka Koskinen
2014-12-09 3:48 ` Zhang Rui
1 sibling, 1 reply; 6+ messages in thread
From: Ilkka Koskinen @ 2014-12-09 2:01 UTC (permalink / raw)
To: linux-pm; +Cc: ilkka.koskinen, rui.zhang, edubezval, jacob.jun.pan
If either of the entries was missing, the driver tried to free memory
using uninitialized pointer. In addition, it was dereferencing null
pointer.
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
index e4e61b3..ee4ed3b 100644
--- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
@@ -82,7 +82,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" };
if (!acpi_has_method(handle, "_TRT"))
- return 0;
+ return -EEXIST;
status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer);
if (ACPI_FAILURE(status))
@@ -167,7 +167,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" };
if (!acpi_has_method(handle, "_ART"))
- return 0;
+ return -EEXIST;
status = acpi_evaluate_object(handle, "_ART", NULL, &buffer);
if (ACPI_FAILURE(status))
@@ -321,8 +321,8 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
unsigned long length = 0;
int count = 0;
char __user *arg = (void __user *)__arg;
- struct trt *trts;
- struct art *arts;
+ struct trt *trts = NULL;
+ struct art *arts = NULL;
switch (cmd) {
case ACPI_THERMAL_GET_TRT_COUNT:
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing
2014-12-09 2:01 ` [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing Ilkka Koskinen
@ 2014-12-09 3:48 ` Zhang Rui
2014-12-09 20:26 ` Ilkka Koskinen
0 siblings, 1 reply; 6+ messages in thread
From: Zhang Rui @ 2014-12-09 3:48 UTC (permalink / raw)
To: Ilkka Koskinen; +Cc: linux-pm, edubezval, jacob.jun.pan
On Mon, 2014-12-08 at 18:01 -0800, Ilkka Koskinen wrote:
> If either of the entries was missing, the driver tried to free memory
> using uninitialized pointer. In addition, it was dereferencing null
> pointer.
>
> Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com>
> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
> drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> index e4e61b3..ee4ed3b 100644
> --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> @@ -82,7 +82,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
> struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" };
>
> if (!acpi_has_method(handle, "_TRT"))
> - return 0;
> + return -EEXIST;
>
If the control method does not exist, shouldn't we return -ENODEV or
-ENOENT instead?
thanks,
rui
> status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer);
> if (ACPI_FAILURE(status))
> @@ -167,7 +167,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
> sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" };
>
> if (!acpi_has_method(handle, "_ART"))
> - return 0;
> + return -EEXIST;
>
> status = acpi_evaluate_object(handle, "_ART", NULL, &buffer);
> if (ACPI_FAILURE(status))
> @@ -321,8 +321,8 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
> unsigned long length = 0;
> int count = 0;
> char __user *arg = (void __user *)__arg;
> - struct trt *trts;
> - struct art *arts;
> + struct trt *trts = NULL;
> + struct art *arts = NULL;
>
> switch (cmd) {
> case ACPI_THERMAL_GET_TRT_COUNT:
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call
2014-12-09 2:01 ` [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call Ilkka Koskinen
@ 2014-12-09 3:48 ` Zhang Rui
0 siblings, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2014-12-09 3:48 UTC (permalink / raw)
To: Ilkka Koskinen; +Cc: linux-pm, edubezval, jacob.jun.pan
On Mon, 2014-12-08 at 18:01 -0800, Ilkka Koskinen wrote:
> Previously the return value of the last acpi_bus_get_device() was
> returned. However, since we only report those issues, it should be
> cleared to continue as expected.
>
> Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com>
> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
applied.
thanks,
rui
> ---
> drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> index ac5c405..e4e61b3 100644
> --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> @@ -131,6 +131,8 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
> pr_warn("Failed to get target ACPI device\n");
> }
>
> + result = 0;
> +
> *trtp = trts;
> /* don't count bad entries */
> *trt_count -= nr_bad_entries;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing
2014-12-09 3:48 ` Zhang Rui
@ 2014-12-09 20:26 ` Ilkka Koskinen
0 siblings, 0 replies; 6+ messages in thread
From: Ilkka Koskinen @ 2014-12-09 20:26 UTC (permalink / raw)
To: Zhang Rui; +Cc: Ilkka Koskinen, linux-pm, edubezval, jacob.jun.pan
On Mon, December 8, 2014 19:48, Zhang Rui wrote:
> On Mon, 2014-12-08 at 18:01 -0800, Ilkka Koskinen wrote:
>> If either of the entries was missing, the driver tried to free memory
>> using uninitialized pointer. In addition, it was dereferencing null
>> pointer.
>>
>> Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com>
>> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
>> ---
>> drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
>> b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
>> index e4e61b3..ee4ed3b 100644
>> --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
>> +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
>> @@ -82,7 +82,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count,
>> struct trt **trtp,
>> struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" };
>>
>> if (!acpi_has_method(handle, "_TRT"))
>> - return 0;
>> + return -EEXIST;
>>
> If the control method does not exist, shouldn't we return -ENODEV or
> -ENOENT instead?
Absolutely! I wonder why I had chosen that one. I change them
to -ENODEV and submit a new version of this patch.
Cheers, Ilkka
> thanks,
> rui
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-09 20:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09 2:01 [PATCH 0/2] Thermal/int340x: _art and _trt fixes Ilkka Koskinen
2014-12-09 2:01 ` [PATCH 1/2] Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call Ilkka Koskinen
2014-12-09 3:48 ` Zhang Rui
2014-12-09 2:01 ` [PATCH 2/2] Thermal/int340x: Handle properly the case when _trt or _art acpi entry is missing Ilkka Koskinen
2014-12-09 3:48 ` Zhang Rui
2014-12-09 20:26 ` Ilkka Koskinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).