Skip to content

Commit 9620a78

Browse files
osmtenJiri Kosina
authored andcommitted
HID: hid-wiimote-debug.c: Drop error checking for debugfs_create_file
This patch removes the error checking for debugfs_create_file in hid-wiimote-debug.c.c. This is because the debugfs_create_file() does not return NULL but an ERR_PTR after an error. The DebugFS kernel API is developed in a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes.The debugfs Api handles it gracefully. The check is unnecessary. Link to the comment above debugfs_create_file: https://elixir.bootlin.com/linux/latest/source/fs/debugfs/inode.c#L451 Signed-off-by: Osama Muhammad <[email protected]> Reviewed-by: David Rheinsberg <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 1d75460 commit 9620a78

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

drivers/hid/hid-wiimote-debug.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ int wiidebug_init(struct wiimote_data *wdata)
173173
{
174174
struct wiimote_debug *dbg;
175175
unsigned long flags;
176-
int ret = -ENOMEM;
177176

178177
dbg = kzalloc(sizeof(*dbg), GFP_KERNEL);
179178
if (!dbg)
@@ -183,25 +182,16 @@ int wiidebug_init(struct wiimote_data *wdata)
183182

184183
dbg->eeprom = debugfs_create_file("eeprom", S_IRUSR,
185184
dbg->wdata->hdev->debug_dir, dbg, &wiidebug_eeprom_fops);
186-
if (!dbg->eeprom)
187-
goto err;
188185

189186
dbg->drm = debugfs_create_file("drm", S_IRUSR,
190187
dbg->wdata->hdev->debug_dir, dbg, &wiidebug_drm_fops);
191-
if (!dbg->drm)
192-
goto err_drm;
193188

194189
spin_lock_irqsave(&wdata->state.lock, flags);
195190
wdata->debug = dbg;
196191
spin_unlock_irqrestore(&wdata->state.lock, flags);
197192

198193
return 0;
199194

200-
err_drm:
201-
debugfs_remove(dbg->eeprom);
202-
err:
203-
kfree(dbg);
204-
return ret;
205195
}
206196

207197
void wiidebug_deinit(struct wiimote_data *wdata)

0 commit comments

Comments
 (0)