[PATCH] NVMe:Expose model attribute in sysfs
Sujith Pandel
sujithpshankar at gmail.com
Tue Sep 1 09:55:58 PDT 2015
On Tue, Aug 25, 2015 at 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
More information about the Linux-nvme
mailing list