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().

MFC after:	1 week
This commit is contained in:
Toomas Soome 2019-12-13 08:41:37 +00:00
parent 68031519c9
commit 0c48989582

View File

@ -52,6 +52,7 @@ devopen(struct open_file *f, const char *fname, const char **file)
result = dev->d_dev->dv_open(f, dev); result = dev->d_dev->dv_open(f, dev);
if (result != 0) { if (result != 0) {
f->f_devdata = NULL; f->f_devdata = NULL;
f->f_dev = NULL;
free(dev); free(dev);
return (result); return (result);
} }
@ -74,8 +75,6 @@ int
devclose(struct open_file *f) devclose(struct open_file *f)
{ {
if (f->f_devdata != NULL) { free(f->f_devdata);
free(f->f_devdata);
}
return (0); return (0);
} }