From: Greg KH <greg@kroah.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: ecashin@coraid.com, Andrew Morton <akpm@osdl.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/block/aoe: handle sysfs errors
Date: Wed, 4 Oct 2006 16:31:59 -0700 [thread overview]
Message-ID: <20061004233159.GB16204@kroah.com> (raw)
In-Reply-To: <20061004135819.GA29526@havoc.gtf.org>
On Wed, Oct 04, 2006 at 09:58:19AM -0400, Jeff Garzik wrote:
>
> Signed-off-by: Jeff Garzik <jeff@garzik.org>
>
> ---
>
> 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
prev parent reply other threads:[~2006-10-04 23:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-04 13:58 Jeff Garzik
2006-10-04 23:26 ` Greg KH
2006-10-04 23:31 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061004233159.GB16204@kroah.com \
--to=greg@kroah.com \
--cc=akpm@osdl.org \
--cc=ecashin@coraid.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®