Messages in this thread | | | Date | Sat, 18 Mar 2023 16:54:26 +0000 | From | Thomas Weißschuh <> | Subject | Re: [PATCH v2 2/4] blk-integrity: convert to struct device_attribute |
| |
On Wed, Mar 15, 2023 at 08:03:00AM -0700, Christoph Hellwig wrote: > > + container_of(attr, struct device_attribute, attr); > > ssize_t ret = 0; > > > > + if (dev_attr->store) > > + ret = dev_attr->store(dev, dev_attr, page, count); > > > > return ret; > > This can be simplified to: > > if (!rev_attr->store) > return 0; > return dev_attr->store(dev, dev_attr, page, count); > > (I'm still confused why 0 is the right return value here, but that's not > new in your patch, so better don't rock that boat).
This indeed looks weird.
Please note that this case will become -EIO in the next patch switching over to the standard dev_sysfs_ops.
It shouldn't matter though as all writable attributes all have the store() handler defined.
> > +static ssize_t format_show(struct device *dev, struct device_attribute *attr, char *page) > > Please avoid the overly long line here. an in the other methods.
This was following the "new" 100-characters per line limit. The new revision will follow the limit with 80.
| |