Commit 99897efd authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Greg Kroah-Hartman

nvmem: core: let stride and word_size default to 1

If the caller doesn't set stride and/or word_size in struct nvmem_config
then nvmem_register accepts this but we may face strange effects later
due to both values being 0. Therefore use 1 as default for both values.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f3044c3
...@@ -464,8 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) ...@@ -464,8 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->owner = config->owner; nvmem->owner = config->owner;
if (!nvmem->owner && config->dev->driver) if (!nvmem->owner && config->dev->driver)
nvmem->owner = config->dev->driver->owner; nvmem->owner = config->dev->driver->owner;
nvmem->stride = config->stride; nvmem->stride = config->stride ?: 1;
nvmem->word_size = config->word_size; nvmem->word_size = config->word_size ?: 1;
nvmem->size = config->size; nvmem->size = config->size;
nvmem->dev.type = &nvmem_provider_type; nvmem->dev.type = &nvmem_provider_type;
nvmem->dev.bus = &nvmem_bus_type; nvmem->dev.bus = &nvmem_bus_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment