Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips/dev * update HPCFB_MULTI codes



details:   https://anonhg.NetBSD.org/src/rev/583d23323b76
branches:  trunk
changeset: 501015:583d23323b76
user:      sato <sato%NetBSD.org@localhost>
date:      Fri Dec 22 08:37:17 2000 +0000

description:
* update HPCFB_MULTI codes
- check malloc() return value.
- disable multi screen feature when console is serial.
  XXXX: bacause hpcfb multiscreen feature buggy in serial console.

diffstat:

 sys/arch/hpcmips/dev/hpcfb.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r 18c7ef1b5ce4 -r 583d23323b76 sys/arch/hpcmips/dev/hpcfb.c
--- a/sys/arch/hpcmips/dev/hpcfb.c      Fri Dec 22 07:02:49 2000 +0000
+++ b/sys/arch/hpcmips/dev/hpcfb.c      Fri Dec 22 08:37:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpcfb.c,v 1.23 2000/12/21 03:30:36 sato Exp $  */
+/*     $NetBSD: hpcfb.c,v 1.24 2000/12/22 08:37:17 sato Exp $  */
 
 /*-
  * Copyright (c) 1999
@@ -46,7 +46,7 @@
 static const char _copyright[] __attribute__ ((unused)) =
     "Copyright (c) 1999 Shin Takemura.  All rights reserved.";
 static const char _rcsid[] __attribute__ ((unused)) =
-    "$Id: hpcfb.c,v 1.23 2000/12/21 03:30:36 sato Exp $";
+    "$Id: hpcfb.c,v 1.24 2000/12/22 08:37:17 sato Exp $";
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -729,13 +729,17 @@
        DPRINTF(("%s(%d): hpcfb_alloc_screen()\n", __FILE__, __LINE__));
 
 #ifdef HPCFB_MULTI
+       if (!hpcfbconsole && sc->nscreens > 0)  /* XXXXX */
+               return ENOMEM;
+
        if (sc->nscreens > HPCFB_MAX_SCREEN)
                return (ENOMEM);
 
-
        if (sc->screens[sc->nscreens] == NULL){
                sc->screens[sc->nscreens] =
                        malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK);
+               if (sc->screens[sc->nscreens] == NULL)
+                       return ENOMEM;
                bzero(sc->screens[sc->nscreens], sizeof(struct hpcfb_devconfig));
        }
        dc = sc->screens[sc->nscreens];
@@ -751,6 +755,11 @@
                dc->dc_tvram = 
                        malloc(sizeof(struct hpcfb_tvrow)*dc->dc_rows,
                                M_DEVBUF, M_WAITOK);
+               if (dc->dc_tvram == NULL){
+                       free(sc->screens[sc->nscreens], M_DEVBUF);
+                       sc->screens[sc->nscreens] = NULL;
+                       return ENOMEM;
+               }
                bzero(dc->dc_tvram, 
                                sizeof(struct hpcfb_tvrow)*dc->dc_rows);
        }
@@ -760,7 +769,6 @@
        sc->nscreens++;
        *cookiep = dc; 
        hpcfb_alloc_attr(*cookiep, 7, 0, 0, attrp);
-       hpcfb_eraserows(*cookiep, 0, dc->dc_rows, *attrp);
 #else /* HPCFB_MULTI */
        if (sc->nscreens > 0)
                return (ENOMEM);



Home | Main Index | Thread Index | Old Index