Skip to content

Commit 68d9787

Browse files
Mani-Sadhasivammathieupoirier
authored andcommitted
remoteproc: Don't bother checking the return value of debugfs_create*
DebugFS APIs are designed to return only the error pointers and not NULL in the case of failure. So these return pointers are safe to be passed on to the successive debugfs_create* APIs. Therefore, let's just get rid of the checks. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20220329154616.58902-1-manivannan.sadhasivam@linaro.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent f20e232 commit 68d9787

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

drivers/remoteproc/remoteproc_core.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,6 @@ static int rproc_handle_trace(struct rproc *rproc, void *ptr,
684684

685685
/* create the debugfs entry */
686686
trace->tfile = rproc_create_trace_file(name, rproc, trace);
687-
if (!trace->tfile) {
688-
kfree(trace);
689-
return -EINVAL;
690-
}
691687

692688
list_add_tail(&trace->node, &rproc->traces);
693689

drivers/remoteproc/remoteproc_debugfs.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,8 @@ void rproc_remove_trace_file(struct dentry *tfile)
386386
struct dentry *rproc_create_trace_file(const char *name, struct rproc *rproc,
387387
struct rproc_debug_trace *trace)
388388
{
389-
struct dentry *tfile;
390-
391-
tfile = debugfs_create_file(name, 0400, rproc->dbg_dir, trace,
389+
return debugfs_create_file(name, 0400, rproc->dbg_dir, trace,
392390
&trace_rproc_ops);
393-
if (!tfile) {
394-
dev_err(&rproc->dev, "failed to create debugfs trace entry\n");
395-
return NULL;
396-
}
397-
398-
return tfile;
399391
}
400392

401393
void rproc_delete_debug_dir(struct rproc *rproc)
@@ -411,8 +403,6 @@ void rproc_create_debug_dir(struct rproc *rproc)
411403
return;
412404

413405
rproc->dbg_dir = debugfs_create_dir(dev_name(dev), rproc_dbg);
414-
if (!rproc->dbg_dir)
415-
return;
416406

417407
debugfs_create_file("name", 0400, rproc->dbg_dir,
418408
rproc, &rproc_name_ops);
@@ -430,11 +420,8 @@ void rproc_create_debug_dir(struct rproc *rproc)
430420

431421
void __init rproc_init_debugfs(void)
432422
{
433-
if (debugfs_initialized()) {
423+
if (debugfs_initialized())
434424
rproc_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
435-
if (!rproc_dbg)
436-
pr_err("can't create debugfs dir\n");
437-
}
438425
}
439426

440427
void __exit rproc_exit_debugfs(void)

0 commit comments

Comments
 (0)