aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvmem
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-12-15 09:06:05 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-19 04:39:33 -0500
commit99897efd5aa0e9671946297ede45840bc2052c07 (patch)
tree0211913b3b1195e9163eca35be5fa3415ee44377 /drivers/nvmem
parent9f3044c38c84989c37a6f29683a8899a2980341d (diff)
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: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem')
-rw-r--r--drivers/nvmem/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 93084ab61e0f..4f37c9f3d120 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -464,8 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
464 nvmem->owner = config->owner; 464 nvmem->owner = config->owner;
465 if (!nvmem->owner && config->dev->driver) 465 if (!nvmem->owner && config->dev->driver)
466 nvmem->owner = config->dev->driver->owner; 466 nvmem->owner = config->dev->driver->owner;
467 nvmem->stride = config->stride; 467 nvmem->stride = config->stride ?: 1;
468 nvmem->word_size = config->word_size; 468 nvmem->word_size = config->word_size ?: 1;
469 nvmem->size = config->size; 469 nvmem->size = config->size;
470 nvmem->dev.type = &nvmem_provider_type; 470 nvmem->dev.type = &nvmem_provider_type;
471 nvmem->dev.bus = &nvmem_bus_type; 471 nvmem->dev.bus = &nvmem_bus_type;