Re: [PATCH 3/8] nvmem: Add nvmem_cell_get_optional and devm_nvmem_cell_get_optional

From: Srinivas Kandagatla
Date: Thu Jan 17 2019 - 05:20:19 EST

On 16/01/2019 18:26, Alban wrote:
What is the real use-case here, it does not make sense to me to add this
additional call just to return NULL when cell is not found!
It also return NULL when nvmem is not compiled in. I quiet like such
convenience functions as they make the driver code much simpler and
the intent explicit. It replace:

data->cell = devm_nvmem_cell_get(dev, "my-cell");
if (IS_ERR(data->cell) {
if (PTR_ERR(data->cell) == -ENOENT ||
PTR_ERR(data->cell) == -EOPNOTSUPP)
data->cell = NULL;
return PTR_ERR(data->cell);


data->cell = dev_nvmem_cell_get_optional(dev, "my-cell");
if (IS_ERR(cell))
return PTR_ERR(data->cell);

It's your call if you find that useful or not.
I don't think this should belong to nvmem core in anyway! Its more of consumer specific logic!

I have already applied all of the patches in this series except this one!