Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons Use M_WAITOK if we aren't going to check for ...



details:   https://anonhg.NetBSD.org/src/rev/9902a89c4626
branches:  trunk
changeset: 357264:9902a89c4626
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Nov 03 18:49:37 2017 +0000

description:
Use M_WAITOK if we aren't going to check for NULL before dereferencing
Same function already uses M_WAITOK unconditionally, so this is a safe change

While here, drop null check of M_WAITOK. it shouldn't fail.

diffstat:

 sys/dev/wscons/wsdisplay.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r e7487e44d373 -r 9902a89c4626 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Fri Nov 03 18:42:35 2017 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Fri Nov 03 18:49:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -271,8 +271,6 @@
        struct wsscreen *scr;
 
        scr = malloc(sizeof(struct wsscreen), M_DEVBUF, M_WAITOK);
-       if (!scr)
-               return (NULL);
 
        if (console) {
                dconf = &wsdisplay_console_conf;
@@ -284,7 +282,7 @@
                        (*dconf->wsemul->attach)(1, 0, 0, 0, 0, scr, 0);
        } else { /* not console */
                dconf = malloc(sizeof(struct wsscreen_internal),
-                              M_DEVBUF, M_NOWAIT);
+                              M_DEVBUF, M_WAITOK);
                dconf->emulops = type->textops;
                dconf->emulcookie = cookie;
                if (dconf->emulops) {



Home | Main Index | Thread Index | Old Index