aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYang Li <leoli@freescale.com>2009-05-11 18:36:02 -0400
committerKumar Gala <galak@kernel.crashing.org>2009-06-15 22:45:32 -0400
commit5f28c52003612cccf12dfcbac4d9f0692bd28e67 (patch)
treed51517971a8d76406a91eccc18cb6abf54223504
parent7b9edb9d619a1b3ecd35d832d4a93803d4f0ca5f (diff)
rio: warn_unused_result warnings fix
Adding failure path for the following two cases. warning: ignoring return value of 'device_add', declared with attribute warn_unused_result warning: ignoring return value of 'sysfs_create_bin_file', declared with attribute warn_unused_result Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--drivers/rapidio/rio-scan.c43
-rw-r--r--drivers/rapidio/rio-sysfs.c6
2 files changed, 30 insertions, 19 deletions
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 3b78540288c7..45415096c294 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -263,15 +263,21 @@ static void rio_route_set_ops(struct rio_dev *rdev)
263 * device to the RIO device list. Creates the generic sysfs nodes 263 * device to the RIO device list. Creates the generic sysfs nodes
264 * for an RIO device. 264 * for an RIO device.
265 */ 265 */
266static void __devinit rio_add_device(struct rio_dev *rdev) 266static int __devinit rio_add_device(struct rio_dev *rdev)
267{ 267{
268 device_add(&rdev->dev); 268 int err;
269
270 err = device_add(&rdev->dev);
271 if (err)
272 return err;
269 273
270 spin_lock(&rio_global_list_lock); 274 spin_lock(&rio_global_list_lock);
271 list_add_tail(&rdev->global_list, &rio_devices); 275 list_add_tail(&rdev->global_list, &rio_devices);
272 spin_unlock(&rio_global_list_lock); 276 spin_unlock(&rio_global_list_lock);
273 277
274 rio_create_sysfs_dev_files(rdev); 278 rio_create_sysfs_dev_files(rdev);
279
280 return 0;
275} 281}
276 282
277/** 283/**
@@ -294,13 +300,14 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
294 struct rio_mport *port, u16 destid, 300 struct rio_mport *port, u16 destid,
295 u8 hopcount, int do_enum) 301 u8 hopcount, int do_enum)
296{ 302{
303 int ret = 0;
297 struct rio_dev *rdev; 304 struct rio_dev *rdev;
298 struct rio_switch *rswitch; 305 struct rio_switch *rswitch = NULL;
299 int result, rdid; 306 int result, rdid;
300 307
301 rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL); 308 rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL);
302 if (!rdev) 309 if (!rdev)
303 goto out; 310 return NULL;
304 311
305 rdev->net = net; 312 rdev->net = net;
306 rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, 313 rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR,
@@ -343,23 +350,16 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
343 rio_mport_read_config_32(port, destid, hopcount, 350 rio_mport_read_config_32(port, destid, hopcount,
344 RIO_SWP_INFO_CAR, &rdev->swpinfo); 351 RIO_SWP_INFO_CAR, &rdev->swpinfo);
345 rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL); 352 rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL);
346 if (!rswitch) { 353 if (!rswitch)
347 kfree(rdev); 354 goto cleanup;
348 rdev = NULL;
349 goto out;
350 }
351 rswitch->switchid = next_switchid; 355 rswitch->switchid = next_switchid;
352 rswitch->hopcount = hopcount; 356 rswitch->hopcount = hopcount;
353 rswitch->destid = destid; 357 rswitch->destid = destid;
354 rswitch->route_table = kzalloc(sizeof(u8)* 358 rswitch->route_table = kzalloc(sizeof(u8)*
355 RIO_MAX_ROUTE_ENTRIES(port->sys_size), 359 RIO_MAX_ROUTE_ENTRIES(port->sys_size),
356 GFP_KERNEL); 360 GFP_KERNEL);
357 if (!rswitch->route_table) { 361 if (!rswitch->route_table)
358 kfree(rdev); 362 goto cleanup;
359 rdev = NULL;
360 kfree(rswitch);
361 goto out;
362 }
363 /* Initialize switch route table */ 363 /* Initialize switch route table */
364 for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES(port->sys_size); 364 for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES(port->sys_size);
365 rdid++) 365 rdid++)
@@ -390,10 +390,19 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
390 rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], 390 rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
391 0, 0xffff); 391 0, 0xffff);
392 392
393 rio_add_device(rdev); 393 ret = rio_add_device(rdev);
394 if (ret)
395 goto cleanup;
394 396
395 out:
396 return rdev; 397 return rdev;
398
399cleanup:
400 if (rswitch) {
401 kfree(rswitch->route_table);
402 kfree(rswitch);
403 }
404 kfree(rdev);
405 return NULL;
397} 406}
398 407
399/** 408/**
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 97a147f050d6..ba742e82c57d 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -214,9 +214,11 @@ static struct bin_attribute rio_config_attr = {
214 */ 214 */
215int rio_create_sysfs_dev_files(struct rio_dev *rdev) 215int rio_create_sysfs_dev_files(struct rio_dev *rdev)
216{ 216{
217 sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr); 217 int err = 0;
218 218
219 return 0; 219 err = sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr);
220
221 return err;
220} 222}
221 223
222/** 224/**