The error path for bus initialization is missing a call to put_device().
Add that call. This error path will probably never actually execute,
but any kernel source code may be subject to static checking or re-use.
Cc: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: Daniel Palmer <daniel@0x0f.com>
Suggested-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patch.msgid.link/478d5f080d74b6688c9e3f9132e3fe251e997ad7.1765610469.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
}
EXPORT_SYMBOL(nubus_driver_unregister);
-static struct device nubus_parent = {
- .init_name = "nubus",
-};
-
static int __init nubus_bus_register(void)
{
return bus_register(&nubus_bus_type);
}
postcore_initcall(nubus_bus_register);
-int __init nubus_parent_device_register(void)
-{
- return device_register(&nubus_parent);
-}
-
static void nubus_device_release(struct device *dev)
{
struct nubus_board *board = to_nubus_board(dev);
kfree(board);
}
-int nubus_device_register(struct nubus_board *board)
+int nubus_device_register(struct device *parent, struct nubus_board *board)
{
- board->dev.parent = &nubus_parent;
+ board->dev.parent = parent;
board->dev.release = nubus_device_release;
board->dev.bus = &nubus_bus_type;
dev_set_name(&board->dev, "slot.%X", board->slot);
LIST_HEAD(nubus_func_rsrcs);
+static struct device nubus_parent = {
+ .init_name = "nubus",
+};
+
/* Meaning of "bytelanes":
The card ROM may appear on any or all bytes of each long word in
list_add_tail(&fres->list, &nubus_func_rsrcs);
}
- if (nubus_device_register(board))
+ if (nubus_device_register(&nubus_parent, board))
put_device(&board->dev);
}
return 0;
nubus_proc_init();
- err = nubus_parent_device_register();
- if (err)
+ err = device_register(&nubus_parent);
+ if (err) {
+ put_device(&nubus_parent);
return err;
+ }
nubus_scan_bus();
return 0;
}
unsigned char *nubus_dirptr(const struct nubus_dirent *nd);
/* Declarations relating to driver model objects */
-int nubus_parent_device_register(void);
-int nubus_device_register(struct nubus_board *board);
+int nubus_device_register(struct device *parent, struct nubus_board *board);
int nubus_driver_register(struct nubus_driver *ndrv);
void nubus_driver_unregister(struct nubus_driver *ndrv);
int nubus_proc_show(struct seq_file *m, void *data);