[IA64] Check return from device_register() in cx_device_register()
The device_register() is declared with must_check, causing this: arch/ia64/sn/kernel/tiocx.c: In function 'cx_device_register': arch/ia64/sn/kernel/tiocx.c:210:17: warning: ignoring return value of 'device_register', declared with attribute warn_unused_result Check the return value, and free resources if it fails. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
parent
c19ce0ab53
commit
454ca6040a
|
@ -191,6 +191,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
|
||||||
struct hubdev_info *hubdev, int bt)
|
struct hubdev_info *hubdev, int bt)
|
||||||
{
|
{
|
||||||
struct cx_dev *cx_dev;
|
struct cx_dev *cx_dev;
|
||||||
|
int r;
|
||||||
|
|
||||||
cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
|
cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
|
||||||
DBG("cx_dev= 0x%p\n", cx_dev);
|
DBG("cx_dev= 0x%p\n", cx_dev);
|
||||||
|
@ -207,7 +208,11 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
|
||||||
cx_dev->dev.bus = &tiocx_bus_type;
|
cx_dev->dev.bus = &tiocx_bus_type;
|
||||||
cx_dev->dev.release = tiocx_bus_release;
|
cx_dev->dev.release = tiocx_bus_release;
|
||||||
dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
|
dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
|
||||||
device_register(&cx_dev->dev);
|
r = device_register(&cx_dev->dev);
|
||||||
|
if (r) {
|
||||||
|
kfree(cx_dev);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
get_device(&cx_dev->dev);
|
get_device(&cx_dev->dev);
|
||||||
|
|
||||||
device_create_file(&cx_dev->dev, &dev_attr_cxdev_control);
|
device_create_file(&cx_dev->dev, &dev_attr_cxdev_control);
|
||||||
|
|
Loading…
Reference in New Issue