Skip to content

Commit 0ff0e95

Browse files
Villemoesgregkh
authored andcommitted
devtmpfs: factor out setup part of devtmpfsd()
Factor out the setup part of devtmpfsd() to make it a bit easier to see that we always call setup_done() exactly once (provided of course the kthread is succesfully created). Signed-off-by: Rasmus Villemoes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c9d6b28 commit 0ff0e95

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/base/devtmpfs.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
388388
return handle_remove(name, dev);
389389
}
390390

391-
static int devtmpfsd(void *p)
391+
static int devtmpfs_setup(void *p)
392392
{
393393
int err;
394394

@@ -400,7 +400,18 @@ static int devtmpfsd(void *p)
400400
goto out;
401401
ksys_chdir("/.."); /* will traverse into overmounted root */
402402
ksys_chroot(".");
403+
out:
404+
*(int *)p = err;
403405
complete(&setup_done);
406+
return err;
407+
}
408+
409+
static int devtmpfsd(void *p)
410+
{
411+
int err = devtmpfs_setup(p);
412+
413+
if (err)
414+
return err;
404415
while (1) {
405416
spin_lock(&req_lock);
406417
while (requests) {
@@ -421,10 +432,6 @@ static int devtmpfsd(void *p)
421432
schedule();
422433
}
423434
return 0;
424-
out:
425-
*(int *)p = err;
426-
complete(&setup_done);
427-
return err;
428435
}
429436

430437
/*

0 commit comments

Comments
 (0)