Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/rpi Better error handling.



details:   https://anonhg.NetBSD.org/src/rev/e848d22c04e5
branches:  trunk
changeset: 332682:e848d22c04e5
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Oct 03 17:57:48 2014 +0000

description:
Better error handling.

diffstat:

 sys/arch/evbarm/rpi/vcprop_subr.c |  77 ++++++++++++++++++++++++++++++++------
 1 files changed, 65 insertions(+), 12 deletions(-)

diffs (131 lines):

diff -r edbbcee60524 -r e848d22c04e5 sys/arch/evbarm/rpi/vcprop_subr.c
--- a/sys/arch/evbarm/rpi/vcprop_subr.c Fri Oct 03 14:45:38 2014 +0000
+++ b/sys/arch/evbarm/rpi/vcprop_subr.c Fri Oct 03 17:57:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vcprop_subr.c,v 1.1 2014/09/28 14:38:29 macallan Exp $ */
+/*     $NetBSD: vcprop_subr.c,v 1.2 2014/10/03 17:57:48 skrll Exp $    */
 
 /*
  * Copyright (c) 2014 Michael Lorenz
@@ -90,7 +90,15 @@
            vb_setblank.vbt_blank.state, error, res,
            vb_setblank.vbt_blank.tag.vpt_rcode);
 #endif
-       return (error == 0);
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_setblank.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_setblank.vbt_blank.tag)) {
+               return EIO;
+       }
+
+       return 0;
 }
 
 uint32_t
@@ -131,9 +139,16 @@
            vb_allocmem.vbt_am.size, error, res,
            vb_allocmem.vbt_am.tag.vpt_rcode);
 #endif
-       if (error == 0)
-               return vb_allocmem.vbt_am.size;
-       return 0;
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_allocmem.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_allocmem.vbt_am.tag)) {
+               return EIO;
+       }
+
+       /* Return the handle from the VC */
+       return vb_allocmem.vbt_am.size;
 }
 
 bus_addr_t
@@ -172,9 +187,15 @@
            vb_lockmem.vbt_lm.handle, error, res,
            vb_lockmem.vbt_lm.tag.vpt_rcode);
 #endif
-       if (error == 0)
-               return (vb_lockmem.vbt_lm.handle /*& 0x3fffffff*/);
-       return 0;
+       if (error)
+               return 0;
+
+       if (!vcprop_buffer_success_p(&vb_lockmem.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_lockmem.vbt_lm.tag)) {
+               return 0;
+       }
+
+       return vb_lockmem.vbt_lm.handle;
 }
 
 int
@@ -213,7 +234,15 @@
            vb_unlockmem.vbt_lm.handle, error, res,
            vb_unlockmem.vbt_lm.tag.vpt_rcode);
 #endif
-       return (error == 0);
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_unlockmem.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_unlockmem.vbt_lm.tag)) {
+               return EIO;
+       }
+
+       return 0;
 }
 
 int
@@ -252,7 +281,15 @@
            vb_releasemem.vbt_lm.handle, error, res,
            vb_releasemem.vbt_lm.tag.vpt_rcode);
 #endif
-       return (error == 0);
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_releasemem.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_releasemem.vbt_lm.tag)) {
+               return EIO;
+       }
+
+       return 0;
 }
 
 int
@@ -294,7 +331,15 @@
            vb_cursorstate.vbt_cs.enable, error, res,
            vb_cursorstate.vbt_cs.tag.vpt_rcode);
 #endif
-       return (error == 0);
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_cursorstate.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_cursorstate.vbt_cs.tag)) {
+               return EIO;
+       }
+
+       return 0;
 }
 
 int
@@ -339,5 +384,13 @@
            vb_cursorinfo.vbt_ci.width, error, res,
            vb_cursorinfo.vbt_ci.tag.vpt_rcode);
 #endif
-       return (error == 0);
+       if (error)
+               return error;
+
+       if (!vcprop_buffer_success_p(&vb_cursorinfo.vb_hdr) ||
+           !vcprop_tag_success_p(&vb_cursorinfo.vbt_ci.tag)) {
+               return EIO;
+       }
+
+       return 0;
 }



Home | Main Index | Thread Index | Old Index