Skip to content

Commit 6ae8da4

Browse files
committed
pseries: port papr_rtas_setup_file_interface() to FD_ADD()
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-36-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 274d937 commit 6ae8da4

1 file changed

Lines changed: 5 additions & 22 deletions

File tree

arch/powerpc/platforms/pseries/papr-rtas-common.c

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -205,35 +205,18 @@ long papr_rtas_setup_file_interface(struct papr_rtas_sequence *seq,
205205
char *name)
206206
{
207207
const struct papr_rtas_blob *blob;
208-
struct file *file;
209-
long ret;
210208
int fd;
211209

212210
blob = papr_rtas_retrieve(seq);
213211
if (IS_ERR(blob))
214212
return PTR_ERR(blob);
215213

216-
fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
217-
if (fd < 0) {
218-
ret = fd;
219-
goto free_blob;
220-
}
221-
222-
file = anon_inode_getfile_fmode(name, fops, (void *)blob,
223-
O_RDONLY, FMODE_LSEEK | FMODE_PREAD);
224-
if (IS_ERR(file)) {
225-
ret = PTR_ERR(file);
226-
goto put_fd;
227-
}
228-
229-
fd_install(fd, file);
214+
fd = FD_ADD(O_RDONLY | O_CLOEXEC,
215+
anon_inode_getfile_fmode(name, fops, (void *)blob, O_RDONLY,
216+
FMODE_LSEEK | FMODE_PREAD));
217+
if (fd < 0)
218+
papr_rtas_blob_free(blob);
230219
return fd;
231-
232-
put_fd:
233-
put_unused_fd(fd);
234-
free_blob:
235-
papr_rtas_blob_free(blob);
236-
return ret;
237220
}
238221

239222
/*

0 commit comments

Comments
 (0)