mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] drm/i915: fix error return code in init_pipe_control()
@ 2013-05-28  9:51 Wei Yongjun
  2013-05-28  9:59 ` Daniel Vetter
  2013-05-28 10:05 ` Chris Wilson
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2013-05-28  9:51 UTC (permalink / raw)
  To: daniel.vetter, airlied; +Cc: yongjun_wei, intel-gfx, dri-devel, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return -ENOMEM in the kmap() error handling case
instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 5698fae..9b97cf6 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -464,9 +464,11 @@ init_pipe_control(struct intel_ring_buffer *ring)
 		goto err_unref;
 
 	pc->gtt_offset = obj->gtt_offset;
-	pc->cpu_page =  kmap(sg_page(obj->pages->sgl));
-	if (pc->cpu_page == NULL)
+	pc->cpu_page = kmap(sg_page(obj->pages->sgl));
+	if (pc->cpu_page == NULL) {
+		ret = -ENOMEM;
 		goto err_unpin;
+	}
 
 	DRM_DEBUG_DRIVER("%s pipe control offset: 0x%08x\n",
 			 ring->name, pc->gtt_offset);


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

* Re: [PATCH -next] drm/i915: fix error return code in init_pipe_control()
  2013-05-28  9:51 [PATCH -next] drm/i915: fix error return code in init_pipe_control() Wei Yongjun
@ 2013-05-28  9:59 ` Daniel Vetter
  2013-05-28 10:05 ` Chris Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2013-05-28  9:59 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: daniel.vetter, airlied, yongjun_wei, intel-gfx, dri-devel, linux-kernel

On Tue, May 28, 2013 at 05:51:44PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return -ENOMEM in the kmap() error handling case
> instead of 0, as done elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [PATCH -next] drm/i915: fix error return code in init_pipe_control()
  2013-05-28  9:51 [PATCH -next] drm/i915: fix error return code in init_pipe_control() Wei Yongjun
  2013-05-28  9:59 ` Daniel Vetter
@ 2013-05-28 10:05 ` Chris Wilson
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2013-05-28 10:05 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: daniel.vetter, airlied, yongjun_wei, intel-gfx, dri-devel, linux-kernel

On Tue, May 28, 2013 at 05:51:44PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return -ENOMEM in the kmap() error handling case
> instead of 0, as done elsewhere in this function.

kmap() can fail?

It is either translated to page_address() or kmap_high() (on x86),
neither of which may return NULL. However, only kmap_atomic() is
documented as being guaranteed to return a valid value. If we could
have a similar definitive statement for kmap(), we can then cleanup
quite a bit of redundant error handling.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

end of thread, other threads:[~2013-05-28 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-28  9:51 [PATCH -next] drm/i915: fix error return code in init_pipe_control() Wei Yongjun
2013-05-28  9:59 ` Daniel Vetter
2013-05-28 10:05 ` Chris Wilson

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®