Author: trasz
Date: Tue Aug  9 15:55:14 2016
New Revision: 303875
URL: https://svnweb.freebsd.org/changeset/base/303875

Log:
  Remove NULL checks after M_WAITOK allocations from sys/dev/ofw/.
  
  MFC after:    1 month

Modified:
  head/sys/dev/ofw/openfirmio.c
  head/sys/dev/ofw/openpromio.c

Modified: head/sys/dev/ofw/openfirmio.c
==============================================================================
--- head/sys/dev/ofw/openfirmio.c       Tue Aug  9 15:52:17 2016        
(r303874)
+++ head/sys/dev/ofw/openfirmio.c       Tue Aug  9 15:55:14 2016        
(r303875)
@@ -100,8 +100,6 @@ openfirm_getstr(int len, const char *use
                return (ENAMETOOLONG);
 
        *cpp = cp = malloc(len + 1, M_TEMP, M_WAITOK);
-       if (cp == NULL)
-               return (ENOMEM);
        error = copyin(user, cp, len);
        cp[len] = '\0';
        return (error);
@@ -173,10 +171,6 @@ openfirm_ioctl(struct cdev *dev, u_long 
                if (len <= 0)
                        break;
                value = malloc(len, M_TEMP, M_WAITOK);
-               if (value == NULL) {
-                       error = ENOMEM;
-                       break;
-               }
                len = OF_getprop(node, name, (void *)value, len);
                error = copyout(value, of->of_buf, len);
                break;
@@ -199,10 +193,6 @@ openfirm_ioctl(struct cdev *dev, u_long 
                if (error)
                        break;
                value = malloc(of->of_buflen, M_TEMP, M_WAITOK);
-               if (value == NULL) {
-                       error = ENOMEM;
-                       break;
-               }
                error = copyin(of->of_buf, value, of->of_buflen);
                if (error)
                        break;

Modified: head/sys/dev/ofw/openpromio.c
==============================================================================
--- head/sys/dev/ofw/openpromio.c       Tue Aug  9 15:52:17 2016        
(r303874)
+++ head/sys/dev/ofw/openpromio.c       Tue Aug  9 15:55:14 2016        
(r303875)
@@ -151,18 +151,10 @@ openprom_ioctl(struct cdev *dev, u_long 
                        break;
                }
                prop = malloc(len, M_TEMP, M_WAITOK | M_ZERO);
-               if (prop == NULL) {
-                       error = ENOMEM;
-                       break;
-               }
                error = copyinstr(&oprom->oprom_array, prop, len, &done);
                if (error != 0)
                        break;
                buf = malloc(OPROMMAXPARAM, M_TEMP, M_WAITOK | M_ZERO);
-               if (buf == NULL) {
-                       error = ENOMEM;
-                       break;
-               }
                node = openprom_node;
                switch (cmd) {
                case OPROMGETPROP:
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to