diff mbox series

drm/i915/guc/rc: Use i915_probe_error instead of drm_error

Message ID 20220506054142.5025-1-vinay.belgaumkar@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/guc/rc: Use i915_probe_error instead of drm_error | expand

Commit Message

Vinay Belgaumkar May 6, 2022, 5:41 a.m. UTC
To avoid false positives in error injection cases.

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Alan Previn May 13, 2022, 5:16 p.m. UTC | #1
Nit: not sure why we use ERR_PTR for int when calling func was also returning an int.
Anyway, that was how the original code was, so:

Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>


On Thu, 2022-05-05 at 22:41 -0700, Vinay Belgaumkar wrote:
> To avoid false positives in error injection cases.
> 
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
> index e00661fb0853..8f8dd05835c5 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
> @@ -49,7 +49,6 @@ static int guc_action_control_gucrc(struct intel_guc *guc, bool enable)
>  static int __guc_rc_control(struct intel_guc *guc, bool enable)
>  {
>  	struct intel_gt *gt = guc_to_gt(guc);
> -	struct drm_device *drm = &guc_to_gt(guc)->i915->drm;
>  	int ret;
>  
>  	if (!intel_uc_uses_guc_rc(&gt->uc))
> @@ -60,8 +59,8 @@ static int __guc_rc_control(struct intel_guc *guc, bool enable)
>  
>  	ret = guc_action_control_gucrc(guc, enable);
>  	if (ret) {
> -		drm_err(drm, "Failed to %s GuC RC (%pe)\n",
> -			str_enable_disable(enable), ERR_PTR(ret));
> +		i915_probe_error(guc_to_gt(guc)->i915, "Failed to %s GuC RC (%pe)\n",
> +				 str_enable_disable(enable), ERR_PTR(ret));
>  		return ret;
>  	}
>  
> -- 
> 2.35.1
>
Jani Nikula May 16, 2022, 8:09 a.m. UTC | #2
On Fri, 13 May 2022, "Teres Alexis, Alan Previn" <alan.previn.teres.alexis@intel.com> wrote:
> Nit: not sure why we use ERR_PTR for int when calling func was also returning an int.
> Anyway, that was how the original code was, so:

%pe on an error pointer prints the symbolic error name if
CONFIG_SYMBOLIC_ERRNAME=y and the errno is known, decimal error code
otherwise. It's not obvious, basically all the non-standard printf
formats are a bit mysterious, but there's also no neat alternative.


BR,
Jani.


>
> Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>
>
>
> On Thu, 2022-05-05 at 22:41 -0700, Vinay Belgaumkar wrote:
>> To avoid false positives in error injection cases.
>> 
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
>> index e00661fb0853..8f8dd05835c5 100644
>> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
>> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
>> @@ -49,7 +49,6 @@ static int guc_action_control_gucrc(struct intel_guc *guc, bool enable)
>>  static int __guc_rc_control(struct intel_guc *guc, bool enable)
>>  {
>>  	struct intel_gt *gt = guc_to_gt(guc);
>> -	struct drm_device *drm = &guc_to_gt(guc)->i915->drm;
>>  	int ret;
>>  
>>  	if (!intel_uc_uses_guc_rc(&gt->uc))
>> @@ -60,8 +59,8 @@ static int __guc_rc_control(struct intel_guc *guc, bool enable)
>>  
>>  	ret = guc_action_control_gucrc(guc, enable);
>>  	if (ret) {
>> -		drm_err(drm, "Failed to %s GuC RC (%pe)\n",
>> -			str_enable_disable(enable), ERR_PTR(ret));
>> +		i915_probe_error(guc_to_gt(guc)->i915, "Failed to %s GuC RC (%pe)\n",
>> +				 str_enable_disable(enable), ERR_PTR(ret));
>>  		return ret;
>>  	}
>>  
>> -- 
>> 2.35.1
>> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
index e00661fb0853..8f8dd05835c5 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
@@ -49,7 +49,6 @@  static int guc_action_control_gucrc(struct intel_guc *guc, bool enable)
 static int __guc_rc_control(struct intel_guc *guc, bool enable)
 {
 	struct intel_gt *gt = guc_to_gt(guc);
-	struct drm_device *drm = &guc_to_gt(guc)->i915->drm;
 	int ret;
 
 	if (!intel_uc_uses_guc_rc(&gt->uc))
@@ -60,8 +59,8 @@  static int __guc_rc_control(struct intel_guc *guc, bool enable)
 
 	ret = guc_action_control_gucrc(guc, enable);
 	if (ret) {
-		drm_err(drm, "Failed to %s GuC RC (%pe)\n",
-			str_enable_disable(enable), ERR_PTR(ret));
+		i915_probe_error(guc_to_gt(guc)->i915, "Failed to %s GuC RC (%pe)\n",
+				 str_enable_disable(enable), ERR_PTR(ret));
 		return ret;
 	}