mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: Remove incorrect IS_ERR() check
@ 2023-10-20 10:44 Steven Price
  2023-10-21 18:44 ` Adrián Larumbe
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Price @ 2023-10-20 10:44 UTC (permalink / raw)
  To: Boris Brezillon, Rob Herring
  Cc: Steven Price, dri-devel, linux-kernel, Adrián Larumbe,
	Dan Carpenter

sg_page_iter_page() doesn't return an error code, so the IS_ERR() check
is wrong and the error path will never be executed. This also allows
simplifying the code to remove the local variable 'page'.

CC: Adrián Larumbe <adrian.larumbe@collabora.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/376713ff-9a4f-4ea3-b097-fb5efb685d95@moroto.mountain
Signed-off-by: Steven Price <steven.price@arm.com>
---
 drivers/gpu/drm/panfrost/panfrost_dump.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_dump.c b/drivers/gpu/drm/panfrost/panfrost_dump.c
index e7942ac449c6..47751302f1bc 100644
--- a/drivers/gpu/drm/panfrost/panfrost_dump.c
+++ b/drivers/gpu/drm/panfrost/panfrost_dump.c
@@ -220,16 +220,8 @@ void panfrost_core_dump(struct panfrost_job *job)
 
 		iter.hdr->bomap.data[0] = bomap - bomap_start;
 
-		for_each_sgtable_page(bo->base.sgt, &page_iter, 0) {
-			struct page *page = sg_page_iter_page(&page_iter);
-
-			if (!IS_ERR(page)) {
-				*bomap++ = page_to_phys(page);
-			} else {
-				dev_err(pfdev->dev, "Panfrost Dump: wrong page\n");
-				*bomap++ = 0;
-			}
-		}
+		for_each_sgtable_page(bo->base.sgt, &page_iter, 0)
+			*bomap++ = page_to_phys(sg_page_iter_page(&page_iter));
 
 		iter.hdr->bomap.iova = mapping->mmnode.start << PAGE_SHIFT;
 
-- 
2.34.1


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

* Re: [PATCH] drm/panfrost: Remove incorrect IS_ERR() check
  2023-10-20 10:44 [PATCH] drm/panfrost: Remove incorrect IS_ERR() check Steven Price
@ 2023-10-21 18:44 ` Adrián Larumbe
  0 siblings, 0 replies; 2+ messages in thread
From: Adrián Larumbe @ 2023-10-21 18:44 UTC (permalink / raw)
  To: Steven Price
  Cc: Boris Brezillon, Rob Herring, dri-devel, linux-kernel, Dan Carpenter

On 20.10.2023 11:44, Steven Price wrote:
> sg_page_iter_page() doesn't return an error code, so the IS_ERR() check
> is wrong and the error path will never be executed. This also allows
> simplifying the code to remove the local variable 'page'.
> 
> CC: Adrián Larumbe <adrian.larumbe@collabora.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/376713ff-9a4f-4ea3-b097-fb5efb685d95@moroto.mountain
> Signed-off-by: Steven Price <steven.price@arm.com>

Reviewed-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Tested-by: Adrián Larumbe <adrian.larumbe@collabora.com>

> ---
>  drivers/gpu/drm/panfrost/panfrost_dump.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_dump.c b/drivers/gpu/drm/panfrost/panfrost_dump.c
> index e7942ac449c6..47751302f1bc 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_dump.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_dump.c
> @@ -220,16 +220,8 @@ void panfrost_core_dump(struct panfrost_job *job)
>  
>  		iter.hdr->bomap.data[0] = bomap - bomap_start;
>  
> -		for_each_sgtable_page(bo->base.sgt, &page_iter, 0) {
> -			struct page *page = sg_page_iter_page(&page_iter);
> -
> -			if (!IS_ERR(page)) {
> -				*bomap++ = page_to_phys(page);
> -			} else {
> -				dev_err(pfdev->dev, "Panfrost Dump: wrong page\n");
> -				*bomap++ = 0;
> -			}
> -		}
> +		for_each_sgtable_page(bo->base.sgt, &page_iter, 0)
> +			*bomap++ = page_to_phys(sg_page_iter_page(&page_iter));
>  
>  		iter.hdr->bomap.iova = mapping->mmnode.start << PAGE_SHIFT;
>  
> -- 
> 2.34.1

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

end of thread, other threads:[~2023-10-21 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 10:44 [PATCH] drm/panfrost: Remove incorrect IS_ERR() check Steven Price
2023-10-21 18:44 ` Adrián Larumbe

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®