> > > device_initialize(&nvmem->dev);> > diff --git a/drivers/nvmem/nvmem-sysfs.c b/drivers/nvmem/nvmem-sysfs.c> > index 9e0c429cd..00d3259ea 100644> > --- a/drivers/nvmem/nvmem-sysfs.c> > +++ b/drivers/nvmem/nvmem-sysfs.c> > @@ -196,16 +196,50 @@ static const struct attribute_group *nvmem_ro_root_dev_groups[] = {> > NULL,> > };> > +/* write only permission, root only */> > +static struct bin_attribute bin_attr_wo_root_nvmem = {> > TBH, you would not need this patch once 2/3 patch is applied.> Unless there is a strong reason for you to have write only file.This was the whole reason. The Thunderbolt NULL dereference was because write-only was needed but not available. Mika Westerberg thought that by not providing reg_read, the nvmem would become write-only. I discovered the NULL dereference and that is why I am here - to provide the sought-after write-only support. So yes, there is a reason to have write-only.

> > If for any reasons you would want to add Write only file then it should be> added for both with root and user privileges.Mika just advised me that we should not have world-writable files, so it sounds like this needs some discussion between us. I am happy to provide this if that is desired, as the world-writable will presumably only be used if there is a driver that asks for it and has a good reason to use it, so it should not be unsafe.

Part of me agrees that there should be no need for world-writable (I cannot think of a use-case) but the other part knows that something could come along, and that we should cover all bases. Just like we did not see the need for write-only.

> > > + return config->root_only ?> > + nvmem_rw_root_dev_groups : nvmem_rw_dev_groups;> > +> > + /* Write-only, do not honour request for global writable entry */> > + if (!nvmem->reg_read && nvmem->reg_write)> > + return config->root_only ? nvmem_wo_root_dev_groups : NULL;> > +> > + /* Neither reg_read nor reg_write are provided, abort */> This should not be the case anymore after this check in place> > https://git.kernel.org/pub/scm/linux/kernel/git/srini/nvmem.git/commit/?h=for-next&id=f8f782f63bace8b08362e466747e648ca57b6c06Nice. I can change the comment, but all code paths need a return value. I do not know if the compiler is smart enough to figure out that the final return statement is unreachable. So I will still be returning NULL at the end to avoid warnings.