summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-09 20:18:59 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-09 20:18:59 -0800
commitb33c3b84045e880d8a7596f260860038c71cf393 (patch)
tree44981364aebf72db58091e58c427ad26577aa29d
parentc48953d81972bfe16a9e3551883992aa6efe541a (diff)
parentcb39cf99d88e8f2c68a41fb3bb01c4f40a8fcc30 (diff)
Merge tag 'm68k-for-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven: - Add missing put_device() in the NuBus driver - Replace vsprintf() with vsnprintf() on Sun-3 * tag 'm68k-for-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: sun3: Replace vsprintf() with bounded vsnprintf() nubus: Call put_device() in bus initialization error path
-rw-r--r--arch/m68k/sun3/prom/printf.c4
-rw-r--r--drivers/nubus/bus.c13
-rw-r--r--drivers/nubus/nubus.c12
-rw-r--r--include/linux/nubus.h3
4 files changed, 14 insertions, 18 deletions
diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c
index db5537ef1250..cb4934d39833 100644
--- a/arch/m68k/sun3/prom/printf.c
+++ b/arch/m68k/sun3/prom/printf.c
@@ -30,9 +30,9 @@ prom_printf(char *fmt, ...)
#ifdef CONFIG_KGDB
ppbuf[0] = 'O';
- vsprintf(ppbuf + 1, fmt, args) + 1;
+ vsnprintf(ppbuf + 1, sizeof(ppbuf) - 1, fmt, args);
#else
- vsprintf(ppbuf, fmt, args);
+ vsnprintf(ppbuf, sizeof(ppbuf), fmt, args);
#endif
bptr = ppbuf;
diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
index 12df4d88970c..b7d417385d98 100644
--- a/drivers/nubus/bus.c
+++ b/drivers/nubus/bus.c
@@ -51,21 +51,12 @@ void nubus_driver_unregister(struct nubus_driver *ndrv)
}
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);
@@ -79,9 +70,9 @@ static void nubus_device_release(struct device *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);
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index ab0f32b901c8..197c8c0de199 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -41,6 +41,10 @@ module_param_named(populate_procfs, nubus_populate_procfs, bool, 0);
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
@@ -829,7 +833,7 @@ static void __init nubus_add_board(int slot, int bytelanes)
list_add_tail(&fres->list, &nubus_func_rsrcs);
}
- if (nubus_device_register(board))
+ if (nubus_device_register(&nubus_parent, board))
put_device(&board->dev);
}
@@ -882,9 +886,11 @@ static int __init nubus_init(void)
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;
}
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index 4d103ac8f5c7..b8710c825d64 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -162,8 +162,7 @@ void nubus_seq_write_rsrc_mem(struct seq_file *m,
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);