linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sujithpshankar@gmail.com (Sujith Pandel)
Subject: [PATCH] NVMe:Expose model attribute in sysfs
Date: Tue, 1 Sep 2015 22:25:58 +0530	[thread overview]
Message-ID: <20150901165554.GB12201@localhost.localdomain> (raw)
In-Reply-To: <alpine.LNX.2.00.1508251510330.3969@localhost.lm.intel.com>

On Tue, Aug 25, 2015@12:14:39PM -0500, Keith Busch wrote:
> On Mon, 24 Aug 2015, Sujith Pandel wrote:
> > +	result = device_create_file(dev->device, &dev_attr_model);
> > +	if (result) {
> > +		device_remove_file(dev->device, &dev_attr_reset_controller);
> > +		goto put_dev;
> > +	}
> 
> This isn't a very maintainable way to unwind on failure. A new label to
> 'goto' would be better.
> 
> But if we're going to have more than one sysfs entry, we can manage
> this easier using attribute groups instead. There are lots of examples
> in the kernel for this, like scsi_sysfs.c or blk-mq-sysfs.c

Since there are only two sysfs attributes here as of now,
I will be going with your former suggestion of using a new goto label.
Will this be okay:

+       result = device_create_file(dev->device, &dev_attr_model);
+       if (result)
+               goto remove_file;
+

+ remove_file:
+       device_remove_file(dev->device, &dev_attr_reset_controller);
  put_dev:

Please let me know. 
Will send the version-2 of this patch once you confirm.

Regards,
Sujith

  reply	other threads:[~2015-09-01 16:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  4:54 [PATCH] NVMe:Expose model attribute in sysfs Sujith Pandel
2015-08-25 15:38 ` Matthew Wilcox
2015-09-01 16:38   ` Sujith Pandel
2015-08-25 17:14 ` Keith Busch
2015-09-01 16:55   ` Sujith Pandel [this message]
2015-09-01 17:25     ` Keith Busch
2015-09-04  4:54       ` Sujith Pandel
2015-09-08 21:29         ` Keith Busch
2015-09-09  4:46           ` Sujith Pandel

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=20150901165554.GB12201@localhost.localdomain \
    --to=sujithpshankar@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).