All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing@huawei.com>
To: Hanjun Guo <hanjun.guo@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: linux-acpi@vger.kernel.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	Bjorn Helgaas <bhelgaas@google.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dave Airlie <airlied@redhat.com>,
	Hanjun Guo <guohanjun@huawei.com>
Subject: Re: [PATCH v2] ACPI: Fix acpi_evaluate_object() return value check
Date: Fri, 17 Jan 2014 11:51:55 +0800	[thread overview]
Message-ID: <52D8A8DB.4080809@huawei.com> (raw)
In-Reply-To: <52D8A672.8070808@linaro.org>

>> 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


WARNING: multiple messages have this Message-ID (diff)
From: Yijing Wang <wangyijing@huawei.com>
To: Hanjun Guo <hanjun.guo@linaro.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: <linux-acpi@vger.kernel.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	Bjorn Helgaas <bhelgaas@google.com>,
	<intel-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	<linux-pci@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dave Airlie <airlied@redhat.com>,
	Hanjun Guo <guohanjun@huawei.com>
Subject: Re: [PATCH v2] ACPI: Fix acpi_evaluate_object() return value check
Date: Fri, 17 Jan 2014 11:51:55 +0800	[thread overview]
Message-ID: <52D8A8DB.4080809@huawei.com> (raw)
In-Reply-To: <52D8A672.8070808@linaro.org>

>> 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


  reply	other threads:[~2014-01-17  3:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  1:29 [PATCH v2] ACPI: Fix acpi_evaluate_object() return value check Yijing Wang
2014-01-17  1:29 ` Yijing Wang
2014-01-17  3:41 ` Hanjun Guo
2014-01-17  3:51   ` Yijing Wang [this message]
2014-01-17  3:51     ` Yijing Wang
2014-01-18 16:36 ` Konrad Rzeszutek Wilk
2014-01-18 16:36   ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D8A8DB.4080809@huawei.com \
    --to=wangyijing@huawei.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.