diff mbox series

drm/i915: Print return value on error

Message ID 20221014152525.7683-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Print return value on error | expand

Commit Message

Nirmoy Das Oct. 14, 2022, 3:25 p.m. UTC
Print returned error code for better debuggability.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/7211
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jani Nikula Oct. 14, 2022, 3:38 p.m. UTC | #1
On Fri, 14 Oct 2022, Nirmoy Das <nirmoy.das@intel.com> wrote:
> Print returned error code for better debuggability.
>
> References: https://gitlab.freedesktop.org/drm/intel/-/issues/7211
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbdev.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 112aa0447a0d..015a854d9bec 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -175,7 +175,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
>  	}
>  
>  	if (IS_ERR(obj)) {
> -		drm_err(&dev_priv->drm, "failed to allocate framebuffer\n");
> +		drm_err(&dev_priv->drm, "failed to allocate framebuffer(err = %pe)\n", obj);

Nitpick, space before (. With %pe, not sure if the "err =" part is
necessary either.

failed to allocate framebuffer (err = -ENOMEM)

vs.

failed to allocate framebuffer (-ENOMEM)

Ditto below.

BR,
Jani.

>  		return PTR_ERR(obj);
>  	}
>  
> @@ -256,7 +256,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  
>  	info = drm_fb_helper_alloc_fbi(helper);
>  	if (IS_ERR(info)) {
> -		drm_err(&dev_priv->drm, "Failed to allocate fb_info\n");
> +		drm_err(&dev_priv->drm, "Failed to allocate fb_info(err = %pe)\n", info);
>  		ret = PTR_ERR(info);
>  		goto out_unpin;
>  	}
> @@ -291,7 +291,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	vaddr = i915_vma_pin_iomap(vma);
>  	if (IS_ERR(vaddr)) {
>  		drm_err(&dev_priv->drm,
> -			"Failed to remap framebuffer into virtual memory\n");
> +			"Failed to remap framebuffer into virtual memory (err = %pe)\n", vaddr);
>  		ret = PTR_ERR(vaddr);
>  		goto out_unpin;
>  	}
Nirmoy Das Oct. 14, 2022, 3:41 p.m. UTC | #2
On 10/14/2022 5:38 PM, Jani Nikula wrote:
> On Fri, 14 Oct 2022, Nirmoy Das <nirmoy.das@intel.com> wrote:
>> Print returned error code for better debuggability.
>>
>> References: https://gitlab.freedesktop.org/drm/intel/-/issues/7211
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_fbdev.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> index 112aa0447a0d..015a854d9bec 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> @@ -175,7 +175,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
>>   	}
>>   
>>   	if (IS_ERR(obj)) {
>> -		drm_err(&dev_priv->drm, "failed to allocate framebuffer\n");
>> +		drm_err(&dev_priv->drm, "failed to allocate framebuffer(err = %pe)\n", obj);
> Nitpick, space before (. With %pe, not sure if the "err =" part is
> necessary either.
>
> failed to allocate framebuffer (err = -ENOMEM)
>
> vs.
>
> failed to allocate framebuffer (-ENOMEM)


This seems better. Thanks for the quick review, I will resend.


Nirmoy

>
> Ditto below.
>
> BR,
> Jani.
>
>>   		return PTR_ERR(obj);
>>   	}
>>   
>> @@ -256,7 +256,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>>   
>>   	info = drm_fb_helper_alloc_fbi(helper);
>>   	if (IS_ERR(info)) {
>> -		drm_err(&dev_priv->drm, "Failed to allocate fb_info\n");
>> +		drm_err(&dev_priv->drm, "Failed to allocate fb_info(err = %pe)\n", info);
>>   		ret = PTR_ERR(info);
>>   		goto out_unpin;
>>   	}
>> @@ -291,7 +291,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>>   	vaddr = i915_vma_pin_iomap(vma);
>>   	if (IS_ERR(vaddr)) {
>>   		drm_err(&dev_priv->drm,
>> -			"Failed to remap framebuffer into virtual memory\n");
>> +			"Failed to remap framebuffer into virtual memory (err = %pe)\n", vaddr);
>>   		ret = PTR_ERR(vaddr);
>>   		goto out_unpin;
>>   	}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 112aa0447a0d..015a854d9bec 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -175,7 +175,7 @@  static int intelfb_alloc(struct drm_fb_helper *helper,
 	}
 
 	if (IS_ERR(obj)) {
-		drm_err(&dev_priv->drm, "failed to allocate framebuffer\n");
+		drm_err(&dev_priv->drm, "failed to allocate framebuffer(err = %pe)\n", obj);
 		return PTR_ERR(obj);
 	}
 
@@ -256,7 +256,7 @@  static int intelfb_create(struct drm_fb_helper *helper,
 
 	info = drm_fb_helper_alloc_fbi(helper);
 	if (IS_ERR(info)) {
-		drm_err(&dev_priv->drm, "Failed to allocate fb_info\n");
+		drm_err(&dev_priv->drm, "Failed to allocate fb_info(err = %pe)\n", info);
 		ret = PTR_ERR(info);
 		goto out_unpin;
 	}
@@ -291,7 +291,7 @@  static int intelfb_create(struct drm_fb_helper *helper,
 	vaddr = i915_vma_pin_iomap(vma);
 	if (IS_ERR(vaddr)) {
 		drm_err(&dev_priv->drm,
-			"Failed to remap framebuffer into virtual memory\n");
+			"Failed to remap framebuffer into virtual memory (err = %pe)\n", vaddr);
 		ret = PTR_ERR(vaddr);
 		goto out_unpin;
 	}