Factor out check for mounted root file system.
Differential Revision: https://reviews.freebsd.org/D22571 PR: 241639 MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
584061b480
commit
c2a8682ae8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355170
@ -2079,13 +2079,15 @@ linker_load_module(const char *kldname, const char *modname,
|
||||
*/
|
||||
KASSERT(verinfo == NULL, ("linker_load_module: verinfo"
|
||||
" is not NULL"));
|
||||
if (rootvnode == NULL)
|
||||
/* check if root file system is not mounted */
|
||||
if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
|
||||
return (ENXIO);
|
||||
pathname = linker_search_kld(kldname);
|
||||
} else {
|
||||
if (modlist_lookup2(modname, verinfo) != NULL)
|
||||
return (EEXIST);
|
||||
if (rootvnode == NULL)
|
||||
/* check if root file system is not mounted */
|
||||
if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL)
|
||||
return (ENXIO);
|
||||
if (kldname != NULL)
|
||||
pathname = strdup(kldname, M_LINKER);
|
||||
|
@ -257,7 +257,6 @@ firmware_unregister(const char *imagename)
|
||||
static void
|
||||
loadimage(void *arg, int npending)
|
||||
{
|
||||
struct thread *td = curthread;
|
||||
char *imagename = arg;
|
||||
struct priv_fw *fp;
|
||||
linker_file_t result;
|
||||
@ -267,11 +266,6 @@ loadimage(void *arg, int npending)
|
||||
mtx_lock(&firmware_mtx);
|
||||
mtx_unlock(&firmware_mtx);
|
||||
|
||||
if (td->td_proc->p_fd->fd_rdir == NULL) {
|
||||
printf("%s: root not mounted yet, no way to load image\n",
|
||||
imagename);
|
||||
goto done;
|
||||
}
|
||||
error = linker_reference_module(imagename, NULL, &result);
|
||||
if (error != 0) {
|
||||
printf("%s: could not load firmware image, error %d\n",
|
||||
|
Loading…
Reference in New Issue
Block a user