Commit 105a45bf authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] bttv subdev fix

- Make bttv check the device_register return value.

- Yet another unchecked return value fixed.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b743892d
...@@ -63,6 +63,7 @@ static void release_sub_device(struct device *dev) ...@@ -63,6 +63,7 @@ static void release_sub_device(struct device *dev)
int bttv_sub_add_device(struct bttv_core *core, char *name) int bttv_sub_add_device(struct bttv_core *core, char *name)
{ {
struct bttv_sub_device *sub; struct bttv_sub_device *sub;
int err;
sub = kmalloc(sizeof(*sub),GFP_KERNEL); sub = kmalloc(sizeof(*sub),GFP_KERNEL);
if (NULL == sub) if (NULL == sub)
...@@ -76,9 +77,13 @@ int bttv_sub_add_device(struct bttv_core *core, char *name) ...@@ -76,9 +77,13 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
snprintf(sub->dev.bus_id,sizeof(sub->dev.bus_id),"%s%d", snprintf(sub->dev.bus_id,sizeof(sub->dev.bus_id),"%s%d",
name, core->nr); name, core->nr);
err = device_register(&sub->dev);
if (0 != err) {
kfree(sub);
return err;
}
printk("bttv%d: add subdevice \"%s\"\n", core->nr, sub->dev.bus_id); printk("bttv%d: add subdevice \"%s\"\n", core->nr, sub->dev.bus_id);
list_add_tail(&sub->list,&core->subs); list_add_tail(&sub->list,&core->subs);
device_register(&sub->dev);
return 0; return 0;
} }
...@@ -129,8 +134,7 @@ int bttv_sub_register(struct bttv_sub_driver *sub, char *wanted) ...@@ -129,8 +134,7 @@ int bttv_sub_register(struct bttv_sub_driver *sub, char *wanted)
{ {
sub->drv.bus = &bttv_sub_bus_type; sub->drv.bus = &bttv_sub_bus_type;
snprintf(sub->wanted,sizeof(sub->wanted),"%s",wanted); snprintf(sub->wanted,sizeof(sub->wanted),"%s",wanted);
driver_register(&sub->drv); return driver_register(&sub->drv);
return 0;
} }
EXPORT_SYMBOL(bttv_sub_register); EXPORT_SYMBOL(bttv_sub_register);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment