Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2019 08:12:44 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r355928 - stable/12/stand/common
Message-ID:  <201912200812.xBK8Cicd029184@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912200812.xBK8Cicd029184>