Skip to content

Commit b33c3b8

Browse files
committed
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
2 parents c48953d + cb39cf9 commit b33c3b8

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

arch/m68k/sun3/prom/printf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ prom_printf(char *fmt, ...)
3030

3131
#ifdef CONFIG_KGDB
3232
ppbuf[0] = 'O';
33-
vsprintf(ppbuf + 1, fmt, args) + 1;
33+
vsnprintf(ppbuf + 1, sizeof(ppbuf) - 1, fmt, args);
3434
#else
35-
vsprintf(ppbuf, fmt, args);
35+
vsnprintf(ppbuf, sizeof(ppbuf), fmt, args);
3636
#endif
3737

3838
bptr = ppbuf;

drivers/nubus/bus.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,12 @@ void nubus_driver_unregister(struct nubus_driver *ndrv)
5151
}
5252
EXPORT_SYMBOL(nubus_driver_unregister);
5353

54-
static struct device nubus_parent = {
55-
.init_name = "nubus",
56-
};
57-
5854
static int __init nubus_bus_register(void)
5955
{
6056
return bus_register(&nubus_bus_type);
6157
}
6258
postcore_initcall(nubus_bus_register);
6359

64-
int __init nubus_parent_device_register(void)
65-
{
66-
return device_register(&nubus_parent);
67-
}
68-
6960
static void nubus_device_release(struct device *dev)
7061
{
7162
struct nubus_board *board = to_nubus_board(dev);
@@ -79,9 +70,9 @@ static void nubus_device_release(struct device *dev)
7970
kfree(board);
8071
}
8172

82-
int nubus_device_register(struct nubus_board *board)
73+
int nubus_device_register(struct device *parent, struct nubus_board *board)
8374
{
84-
board->dev.parent = &nubus_parent;
75+
board->dev.parent = parent;
8576
board->dev.release = nubus_device_release;
8677
board->dev.bus = &nubus_bus_type;
8778
dev_set_name(&board->dev, "slot.%X", board->slot);

drivers/nubus/nubus.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module_param_named(populate_procfs, nubus_populate_procfs, bool, 0);
4141

4242
LIST_HEAD(nubus_func_rsrcs);
4343

44+
static struct device nubus_parent = {
45+
.init_name = "nubus",
46+
};
47+
4448
/* Meaning of "bytelanes":
4549
4650
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)
829833
list_add_tail(&fres->list, &nubus_func_rsrcs);
830834
}
831835

832-
if (nubus_device_register(board))
836+
if (nubus_device_register(&nubus_parent, board))
833837
put_device(&board->dev);
834838
}
835839

@@ -882,9 +886,11 @@ static int __init nubus_init(void)
882886
return 0;
883887

884888
nubus_proc_init();
885-
err = nubus_parent_device_register();
886-
if (err)
889+
err = device_register(&nubus_parent);
890+
if (err) {
891+
put_device(&nubus_parent);
887892
return err;
893+
}
888894
nubus_scan_bus();
889895
return 0;
890896
}

include/linux/nubus.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ void nubus_seq_write_rsrc_mem(struct seq_file *m,
162162
unsigned char *nubus_dirptr(const struct nubus_dirent *nd);
163163

164164
/* Declarations relating to driver model objects */
165-
int nubus_parent_device_register(void);
166-
int nubus_device_register(struct nubus_board *board);
165+
int nubus_device_register(struct device *parent, struct nubus_board *board);
167166
int nubus_driver_register(struct nubus_driver *ndrv);
168167
void nubus_driver_unregister(struct nubus_driver *ndrv);
169168
int nubus_proc_show(struct seq_file *m, void *data);

0 commit comments

Comments
 (0)