Re: [PATCH v2] ACPI: Fix acpi_evaluate_object() return value check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
>> index dfff090..7ea00e5 100644
>> --- a/drivers/gpu/drm/i915/intel_acpi.c
>> +++ b/drivers/gpu/drm/i915/intel_acpi.c
>> @@ -35,7 +35,7 @@ static int intel_dsm(acpi_handle handle, int func)
>>  	union acpi_object params[4];
>>  	union acpi_object *obj;
>>  	u32 result;
>> -	int ret = 0;
> 
> The 'ret' is removed, but

Ah, it's my mistake, will updata it right now, thanks!

> 
>> +	acpi_status status;
>>  
>>  	input.count = 4;
>>  	input.pointer = params;
>> @@ -50,8 +50,8 @@ static int intel_dsm(acpi_handle handle, int func)
>>  	params[3].package.count = 0;
>>  	params[3].package.elements = NULL;
>>  
>> -	ret = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> -	if (ret) {
>> +	status = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> +	if (ACPI_FAILURE(status)) {
>>  		DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret);
>>  		return ret;
> 
> you still use it here, so you should -EINVAL or something else here.

OK

> 
>>  	}
>> @@ -141,7 +141,8 @@ static void intel_dsm_platform_mux_info(void)
>>  	struct acpi_object_list input;
>>  	union acpi_object params[4];
>>  	union acpi_object *pkg;
>> -	int i, ret;
>> +	acpi_status status;
>>  
>> -	err = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> -	if (err) {
>> +	status = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> +	if (ACPI_FAILURE(status)) {
>>  		printk(KERN_INFO "failed to evaluate _DSM: %d\n", err);
>>  		return err;
> 
> here too.

OK, thanks.

> 
>>  	}
>> @@ -134,7 +135,7 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
>>  	struct acpi_object_list input;
>>  	union acpi_object params[4];
>>  	union acpi_object *obj;
>> -	int err;
>> +	acpi_status status;
>>  
>>  	input.count = 4;
>>  	input.pointer = params;
>> @@ -148,8 +149,8 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
>>  	params[3].type = ACPI_TYPE_INTEGER;
>>  	params[3].integer.value = arg;
>>  
>> -	err = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> -	if (err) {
>> +	status = acpi_evaluate_object(handle, "_DSM", &input, &output);
>> +	if (ACPI_FAILURE(status)) {
>>  		printk(KERN_INFO "failed to evaluate _DSM: %d\n", err);
>>  		return err;
> 
> and here.

thanks.

> 
>>  	}
>> diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
>> index d51f45a..3c21f1b 100644
>> --- a/drivers/pci/pci-label.c
>> +++ b/drivers/pci/pci-label.c
>> @@ -213,7 +213,7 @@ dsm_get_label(acpi_handle handle, int func,
>>  	union acpi_object *obj;
>>  	int len = 0;
>>  
>> -	int err;
>> +	acpi_status status;
>>  
>>  	input.count = 4;
>>  	input.pointer = params;
>> @@ -228,8 +228,8 @@ dsm_get_label(acpi_handle handle, int func,
>>  	params[3].package.count = 0;
>>  	params[3].package.elements = NULL;
>>  
>> -	err = acpi_evaluate_object(handle, "_DSM", &input, output);
>> -	if (err)
>> +	status = acpi_evaluate_object(handle, "_DSM", &input, output);
>> +	if (ACPI_FAILURE(status))
>>  		return -1;
> 
> can we return specific error such as -EINVAL instead of hard code?

I will try to add some more useful debug info here. thanks!

> 
> Thanks
> Hanjun
> 
> .
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux