mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] drm/xe: Use ERR_CAST to return an error-valued pointer
@ 2024-09-06  7:01 Yu Jiaoliang
  2024-09-09 16:13 ` Matthew Brost
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Jiaoliang @ 2024-09-06  7:01 UTC (permalink / raw)
  To: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, intel-xe, dri-devel, linux-kernel
  Cc: opensource.kernel

Instead of directly casting and returning an error-valued pointer,
use ERR_CAST to make the error handling more explicit and improve
code clarity.

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
---
 drivers/gpu/drm/xe/xe_sa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
index fe2cb2a96f78..e055bed7ae55 100644
--- a/drivers/gpu/drm/xe/xe_sa.c
+++ b/drivers/gpu/drm/xe/xe_sa.c
@@ -53,7 +53,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
 	if (IS_ERR(bo)) {
 		drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
 			PTR_ERR(bo));
-		return (struct xe_sa_manager *)bo;
+		return ERR_CAST(bo);
 	}
 	sa_manager->bo = bo;
 	sa_manager->is_iomem = bo->vmap.is_iomem;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] drm/xe: Use ERR_CAST to return an error-valued pointer
  2024-09-06  7:01 [PATCH v1] drm/xe: Use ERR_CAST to return an error-valued pointer Yu Jiaoliang
@ 2024-09-09 16:13 ` Matthew Brost
  2024-09-12 19:30   ` Matthew Brost
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Brost @ 2024-09-09 16:13 UTC (permalink / raw)
  To: Yu Jiaoliang
  Cc: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, intel-xe, dri-devel, linux-kernel,
	opensource.kernel

On Fri, Sep 06, 2024 at 03:01:09PM +0800, Yu Jiaoliang wrote:
> Instead of directly casting and returning an error-valued pointer,
> use ERR_CAST to make the error handling more explicit and improve
> code clarity.
> 
> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_sa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
> index fe2cb2a96f78..e055bed7ae55 100644
> --- a/drivers/gpu/drm/xe/xe_sa.c
> +++ b/drivers/gpu/drm/xe/xe_sa.c
> @@ -53,7 +53,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
>  	if (IS_ERR(bo)) {
>  		drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
>  			PTR_ERR(bo));
> -		return (struct xe_sa_manager *)bo;
> +		return ERR_CAST(bo);
>  	}
>  	sa_manager->bo = bo;
>  	sa_manager->is_iomem = bo->vmap.is_iomem;
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] drm/xe: Use ERR_CAST to return an error-valued pointer
  2024-09-09 16:13 ` Matthew Brost
@ 2024-09-12 19:30   ` Matthew Brost
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Brost @ 2024-09-12 19:30 UTC (permalink / raw)
  To: Yu Jiaoliang
  Cc: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, intel-xe, dri-devel, linux-kernel,
	opensource.kernel

On Mon, Sep 09, 2024 at 04:13:57PM +0000, Matthew Brost wrote:
> On Fri, Sep 06, 2024 at 03:01:09PM +0800, Yu Jiaoliang wrote:
> > Instead of directly casting and returning an error-valued pointer,
> > use ERR_CAST to make the error handling more explicit and improve
> > code clarity.
> > 
> > Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
> 
> Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> 

Merged to drm-xe-next.

Thanks for the patch.

Matt

> > ---
> >  drivers/gpu/drm/xe/xe_sa.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
> > index fe2cb2a96f78..e055bed7ae55 100644
> > --- a/drivers/gpu/drm/xe/xe_sa.c
> > +++ b/drivers/gpu/drm/xe/xe_sa.c
> > @@ -53,7 +53,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
> >  	if (IS_ERR(bo)) {
> >  		drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
> >  			PTR_ERR(bo));
> > -		return (struct xe_sa_manager *)bo;
> > +		return ERR_CAST(bo);
> >  	}
> >  	sa_manager->bo = bo;
> >  	sa_manager->is_iomem = bo->vmap.is_iomem;
> > -- 
> > 2.34.1
> > 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-12 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-06  7:01 [PATCH v1] drm/xe: Use ERR_CAST to return an error-valued pointer Yu Jiaoliang
2024-09-09 16:13 ` Matthew Brost
2024-09-12 19:30   ` Matthew Brost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®