Author: tsoome
Date: Fri Dec 20 08:12:44 2019
New Revision: 355928
URL: https://svnweb.freebsd.org/changeset/base/355928

Log:
  MFC r355703:
  loader: clean up devopen and devclose a bit
  
  devopen should undo setup of f->f_dev in case of error.
  devclose can just call free().

Modified:
  stable/12/stand/common/devopen.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/devopen.c
==============================================================================
--- stable/12/stand/common/devopen.c    Fri Dec 20 07:40:28 2019        
(r355927)
+++ stable/12/stand/common/devopen.c    Fri Dec 20 08:12:44 2019        
(r355928)
@@ -52,6 +52,7 @@ devopen(struct open_file *f, const char *fname, const 
        result = dev->d_dev->dv_open(f, dev);
        if (result != 0) {
                f->f_devdata = NULL;
+               f->f_dev = NULL;
                free(dev);
                return (result);
        }
@@ -74,8 +75,6 @@ int
 devclose(struct open_file *f)
 {
 
-       if (f->f_devdata != NULL) {
-               free(f->f_devdata);
-       }
+       free(f->f_devdata);
        return (0);
 }
_______________________________________________
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