Skip to content

Commit

Permalink
nvmem: core: constify nvmem_cell_read_variable_common() return value
Browse files Browse the repository at this point in the history
The caller doesn't modify the memory pointed to by the pointer so it
can be const.

Suggested-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210611083348.20170-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Douglas Anderson authored and Greg Kroah-Hartman committed Jun 11, 2021
1 parent c813bb3 commit 1f7b4d8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/nvmem/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,9 +1606,9 @@ int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val)
}
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);

static void *nvmem_cell_read_variable_common(struct device *dev,
const char *cell_id,
size_t max_len, size_t *len)
static const void *nvmem_cell_read_variable_common(struct device *dev,
const char *cell_id,
size_t max_len, size_t *len)
{
struct nvmem_cell *cell;
int nbits;
Expand Down Expand Up @@ -1652,7 +1652,7 @@ int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id,
u32 *val)
{
size_t len;
u8 *buf;
const u8 *buf;
int i;

buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);
Expand Down Expand Up @@ -1683,7 +1683,7 @@ int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id,
u64 *val)
{
size_t len;
u8 *buf;
const u8 *buf;
int i;

buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);
Expand Down

0 comments on commit 1f7b4d8

Please sign in to comment.