Module Name:    src
Committed By:   maya
Date:           Fri Nov  3 18:49:37 UTC 2017

Modified Files:
        src/sys/dev/wscons: wsdisplay.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/wscons/wsdisplay.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.142 src/sys/dev/wscons/wsdisplay.c:1.143
--- src/sys/dev/wscons/wsdisplay.c:1.142	Fri May 19 19:22:33 2017
+++ src/sys/dev/wscons/wsdisplay.c	Fri Nov  3 18:49:37 2017
@@ -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 @@ wsscreen_attach(struct wsdisplay_softc *
 	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 @@ wsscreen_attach(struct wsdisplay_softc *
 			(*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) {

Reply via email to