diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-02-26 13:46:07 -0500 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2012-02-27 16:01:42 -0500 |
commit | 454ca6040acc441221d1b07c38c6127947a223d0 (patch) | |
tree | 365d768a12a2fa8820d825b5ee03ddd86df4aae3 /arch/ia64/sn | |
parent | c19ce0ab53ad9698968a154647f3dc22aad6c45b (diff) |
[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>
Diffstat (limited to 'arch/ia64/sn')
-rw-r--r-- | arch/ia64/sn/kernel/tiocx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index c1bd1cfda32..2f406f509d4 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c | |||
@@ -191,6 +191,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num, | |||
191 | struct hubdev_info *hubdev, int bt) | 191 | struct hubdev_info *hubdev, int bt) |
192 | { | 192 | { |
193 | struct cx_dev *cx_dev; | 193 | struct cx_dev *cx_dev; |
194 | int r; | ||
194 | 195 | ||
195 | cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL); | 196 | cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL); |
196 | DBG("cx_dev= 0x%p\n", cx_dev); | 197 | DBG("cx_dev= 0x%p\n", cx_dev); |
@@ -207,7 +208,11 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num, | |||
207 | cx_dev->dev.bus = &tiocx_bus_type; | 208 | cx_dev->dev.bus = &tiocx_bus_type; |
208 | cx_dev->dev.release = tiocx_bus_release; | 209 | cx_dev->dev.release = tiocx_bus_release; |
209 | dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid); | 210 | dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid); |
210 | device_register(&cx_dev->dev); | 211 | r = device_register(&cx_dev->dev); |
212 | if (r) { | ||
213 | kfree(cx_dev); | ||
214 | return r; | ||
215 | } | ||
211 | get_device(&cx_dev->dev); | 216 | get_device(&cx_dev->dev); |
212 | 217 | ||
213 | device_create_file(&cx_dev->dev, &dev_attr_cxdev_control); | 218 | device_create_file(&cx_dev->dev, &dev_attr_cxdev_control); |