On Wed, Oct 04, 2006 at 09:58:19AM -0400, Jeff Garzik wrote:
>
> Signed-off-by: Jeff Garzik <[email protected]>
>
> ---
>
> drivers/block/aoe/aoeblk.c | 64 +++++++++++++++++++++++++++++++++------------
> 1 files changed, 47 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> index 393b86a..04f9b03 100644
> --- a/drivers/block/aoe/aoeblk.c
> +++ b/drivers/block/aoe/aoeblk.c
> @@ -64,13 +64,36 @@ static struct disk_attribute disk_attr_f
> .show = aoedisk_show_fwver
> };
>
> -static void
> +static int
> aoedisk_add_sysfs(struct aoedev *d)
> {
> - sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr);
> - sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
> - sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
> - sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
> + int err;
> +
> + err = sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr);
> + if (err)
> + return err;
> +
> + err = sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr);
> + if (err)
> + goto err_out_state;
> +
> + err = sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr);
> + if (err)
> + goto err_out_mac;
> +
> + err = sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr);
> + if (err)
> + goto err_out_netif;
Oh, and in the future, it's easier to use an attribute group for this
kind of thing than backing out each and every attribute that is added.
The function to add all files in the attribute group properly tears
things down if there is an error along the way.
thanks,
greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]