public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* DRM/ttm: Unreachable code in ttm_bo_add_ttm
@ 2009-12-07 20:42 Jiri Slaby
  2009-12-07 23:28 ` Dave Airlie
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2009-12-07 20:42 UTC (permalink / raw)
  To: Thomas Hellstrom; +Cc: Dave Airlie, dri-devel, LKML

Hi,

Stanse found unreachable code in ttm_bo_add_ttm:
http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238

Excerpt from there:
  230| case ttm_bo_type_user:
  231|  bo->ttm = ttm_tt_create(bdev, bo->num_pages << 12,
  232|     page_flags | (1 << 1),
  233|     glob->dummy_read_page);
  234|  if (bo->ttm == ((void *)0))
  235|   ret = -12;
  236|  break;
  237|
  238|  ret = ttm_tt_set_user(bo->ttm, get_current(),
     |This node is unreachable prev next
  239|          bo->buffer_start, bo->num_pages);
  240|  if (ret != 0)
  241|   ttm_tt_destroy(bo->ttm);
  242|  break;


regards,
-- 
js

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

* Re: DRM/ttm: Unreachable code in ttm_bo_add_ttm
  2009-12-07 20:42 DRM/ttm: Unreachable code in ttm_bo_add_ttm Jiri Slaby
@ 2009-12-07 23:28 ` Dave Airlie
  2009-12-08 10:35   ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Airlie @ 2009-12-07 23:28 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Thomas Hellstrom, Dave Airlie, dri-devel, LKML

On Mon, 7 Dec 2009, Jiri Slaby wrote:

> Hi,
> 
> Stanse found unreachable code in ttm_bo_add_ttm:
> http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238
> 
> Excerpt from there:
>   230| case ttm_bo_type_user:
>   231|  bo->ttm = ttm_tt_create(bdev, bo->num_pages << 12,
>   232|     page_flags | (1 << 1),
>   233|     glob->dummy_read_page);
>   234|  if (bo->ttm == ((void *)0))
>   235|   ret = -12;
>   236|  break;
>   237|
>   238|  ret = ttm_tt_set_user(bo->ttm, get_current(),
>      |This node is unreachable prev next
>   239|          bo->buffer_start, bo->num_pages);
>   240|  if (ret != 0)
>   241|   ttm_tt_destroy(bo->ttm);
>   242|  break;
> 
> 

Thanks,
I've pushed this patch.

>From 447aeb907e417e0e837b4a4026d5081c88b6e8ca Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Tue, 8 Dec 2009 09:25:45 +1000
Subject: [PATCH] drm/ttm: fix unreachable code.

None of the in-tree drivers use user objects yet so this wasn't hitting
us.

Stanse found unreachable code in ttm_bo_add_ttm:
http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 87c0625..e13fd23 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -275,9 +275,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
 		bo->ttm = ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT,
 					page_flags | TTM_PAGE_FLAG_USER,
 					glob->dummy_read_page);
-		if (unlikely(bo->ttm == NULL))
+		if (unlikely(bo->ttm == NULL)) {
 			ret = -ENOMEM;
-		break;
+			break;
+		}
 
 		ret = ttm_tt_set_user(bo->ttm, current,
 				      bo->buffer_start, bo->num_pages);
-- 
1.6.5.2


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

* Re: DRM/ttm: Unreachable code in ttm_bo_add_ttm
  2009-12-07 23:28 ` Dave Airlie
@ 2009-12-08 10:35   ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2009-12-08 10:35 UTC (permalink / raw)
  To: Dave Airlie; +Cc: Thomas Hellstrom, Dave Airlie, dri-devel, LKML

On 12/08/2009 12:28 AM, Dave Airlie wrote:
> From 447aeb907e417e0e837b4a4026d5081c88b6e8ca Mon Sep 17 00:00:00 2001
> From: Dave Airlie <airlied@redhat.com>
> Date: Tue, 8 Dec 2009 09:25:45 +1000
> Subject: [PATCH] drm/ttm: fix unreachable code.
> 
> None of the in-tree drivers use user objects yet so this wasn't hitting
> us.
> 
> Stanse found unreachable code in ttm_bo_add_ttm:
> http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238

Please don't use the link in changelog, it's only temporary. Well, it
will probably be there for months, but the changelog will be there forever.

Thanks.

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

end of thread, other threads:[~2009-12-08 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-07 20:42 DRM/ttm: Unreachable code in ttm_bo_add_ttm Jiri Slaby
2009-12-07 23:28 ` Dave Airlie
2009-12-08 10:35   ` Jiri Slaby

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