@@ -7879,11 +7879,9 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
7879
7879
f = fdget (p -> wq_fd );
7880
7880
if (!f .file )
7881
7881
return - ENXIO ;
7882
- if (f .file -> f_op != & io_uring_fops ) {
7883
- fdput (f );
7884
- return - EINVAL ;
7885
- }
7886
7882
fdput (f );
7883
+ if (f .file -> f_op != & io_uring_fops )
7884
+ return - EINVAL ;
7887
7885
}
7888
7886
if (ctx -> flags & IORING_SETUP_SQPOLL ) {
7889
7887
struct task_struct * tsk ;
@@ -7902,13 +7900,11 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
7902
7900
if (!ctx -> sq_thread_idle )
7903
7901
ctx -> sq_thread_idle = HZ ;
7904
7902
7905
- ret = 0 ;
7906
7903
io_sq_thread_park (sqd );
7907
7904
list_add (& ctx -> sqd_list , & sqd -> ctx_list );
7908
7905
io_sqd_update_thread_idle (sqd );
7909
7906
/* don't attach to a dying SQPOLL thread, would be racy */
7910
- if (attached && !sqd -> thread )
7911
- ret = - ENXIO ;
7907
+ ret = (attached && !sqd -> thread ) ? - ENXIO : 0 ;
7912
7908
io_sq_thread_unpark (sqd );
7913
7909
7914
7910
if (ret < 0 )
@@ -7920,11 +7916,8 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
7920
7916
int cpu = p -> sq_thread_cpu ;
7921
7917
7922
7918
ret = - EINVAL ;
7923
- if (cpu >= nr_cpu_ids )
7924
- goto err_sqpoll ;
7925
- if (!cpu_online (cpu ))
7919
+ if (cpu >= nr_cpu_ids || !cpu_online (cpu ))
7926
7920
goto err_sqpoll ;
7927
-
7928
7921
sqd -> sq_cpu = cpu ;
7929
7922
} else {
7930
7923
sqd -> sq_cpu = -1 ;
@@ -7950,12 +7943,11 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
7950
7943
}
7951
7944
7952
7945
return 0 ;
7946
+ err_sqpoll :
7947
+ complete (& ctx -> sq_data -> exited );
7953
7948
err :
7954
7949
io_sq_thread_finish (ctx );
7955
7950
return ret ;
7956
- err_sqpoll :
7957
- complete (& ctx -> sq_data -> exited );
7958
- goto err ;
7959
7951
}
7960
7952
7961
7953
static inline void __io_unaccount_mem (struct user_struct * user ,
0 commit comments