[-mm Patch]nbd: check the return value of sysfs_create_file

From: WANG Cong
Date: Sat Apr 28 2007 - 01:26:38 EST



Since 'sysfs_create_file' is declared with attribute warn_unused_result, we must always check its return value carefully.

Signed-off-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

---

--- linux-2.6.21-rc7-mm2/drivers/block/nbd.c.orig 2007-04-27 17:27:47.000000000 +0800
+++ linux-2.6.21-rc7-mm2/drivers/block/nbd.c 2007-04-27 17:47:32.000000000 +0800
@@ -373,7 +373,10 @@ static void nbd_do_it(struct nbd_device
BUG_ON(lo->magic != LO_MAGIC);

lo->pid = current->pid;
- sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+ if (sysfs_create_file(&lo->disk->kobj, &pid_attr.attr)) {
+ printk(KERN_ERR "nbd: sysfs_create_file failed!");
+ return;
+ }

while ((req = nbd_read_stat(lo)) != NULL)
nbd_end_request(req);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/