2019-09-09 13:45:11

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCH] nvmem: core: fix nvmem_cell_write inline function

From: Sebastian Reichel <[email protected]>

nvmem_cell_write's buf argument uses different types based on
the configuration of CONFIG_NVMEM. The function prototype for
enabled NVMEM uses 'void *' type, but the static dummy function
for disabled NVMEM uses 'const char *' instead. Fix the different
behaviour by always expecting a 'void *' typed buf argument.

Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
Reported-by: kbuild test robot <[email protected]>
Cc: Han Nandor <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: [email protected]
Signed-off-by: Sebastian Reichel <[email protected]>
---
include/linux/nvmem-consumer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
index 8f8be5b00060..5c17cb733224 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
}

static inline int nvmem_cell_write(struct nvmem_cell *cell,
- const char *buf, size_t len)
+ void *buf, size_t len)
{
return -EOPNOTSUPP;
}
--
2.23.0.rc1


2019-09-09 15:16:39

by Nandor Han

[permalink] [raw]
Subject: Re: [PATCH] nvmem: core: fix nvmem_cell_write inline function

On 9/8/19 3:10 PM, Sebastian Reichel wrote:
> From: Sebastian Reichel <[email protected]>
>
> nvmem_cell_write's buf argument uses different types based on
> the configuration of CONFIG_NVMEM. The function prototype for
> enabled NVMEM uses 'void *' type, but the static dummy function
> for disabled NVMEM uses 'const char *' instead. Fix the different
> behaviour by always expecting a 'void *' typed buf argument.
>
> Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
> Reported-by: kbuild test robot <[email protected]>
> Cc: Han Nandor <[email protected]>
> Cc: Srinivas Kandagatla <[email protected]>
> Cc: [email protected]
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> include/linux/nvmem-consumer.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
> index 8f8be5b00060..5c17cb733224 100644
> --- a/include/linux/nvmem-consumer.h
> +++ b/include/linux/nvmem-consumer.h
> @@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
> }
>
> static inline int nvmem_cell_write(struct nvmem_cell *cell,
> - const char *buf, size_t len)
> + void *buf, size_t len)

nitpick: alignment issue?

Review-By: Han Nandor <[email protected]>

Nandor

2019-09-09 22:29:45

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH] nvmem: core: fix nvmem_cell_write inline function

Hi,

On Mon, Sep 09, 2019 at 12:26:06PM +0300, Nandor Han wrote:
> On 9/8/19 3:10 PM, Sebastian Reichel wrote:
> > From: Sebastian Reichel <[email protected]>
> >
> > nvmem_cell_write's buf argument uses different types based on
> > the configuration of CONFIG_NVMEM. The function prototype for
> > enabled NVMEM uses 'void *' type, but the static dummy function
> > for disabled NVMEM uses 'const char *' instead. Fix the different
> > behaviour by always expecting a 'void *' typed buf argument.
> >
> > Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
> > Reported-by: kbuild test robot <[email protected]>
> > Cc: Han Nandor <[email protected]>
> > Cc: Srinivas Kandagatla <[email protected]>
> > Cc: [email protected]
> > Signed-off-by: Sebastian Reichel <[email protected]>
> > ---
> > include/linux/nvmem-consumer.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
> > index 8f8be5b00060..5c17cb733224 100644
> > --- a/include/linux/nvmem-consumer.h
> > +++ b/include/linux/nvmem-consumer.h
> > @@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
> > }
> > static inline int nvmem_cell_write(struct nvmem_cell *cell,
> > - const char *buf, size_t len)
> > + void *buf, size_t len)
>
> nitpick: alignment issue?

This actually fixes the alignment issue as a side-effect.
I guess I should have mentioned it in the changelog.

> Review-By: Han Nandor <[email protected]>

I suppose you meant to write "Reviewed-by" instead of inventing your
own tag?

-- Sebastian


Attachments:
(No filename) (1.74 kB)
signature.asc (849.00 B)
Download all attachments

2019-09-10 00:50:31

by Nandor Han

[permalink] [raw]
Subject: Re: [PATCH] nvmem: core: fix nvmem_cell_write inline function

On 9/9/19 1:18 PM, Sebastian Reichel wrote:
> Hi,
>
> On Mon, Sep 09, 2019 at 12:26:06PM +0300, Nandor Han wrote:
>> On 9/8/19 3:10 PM, Sebastian Reichel wrote:
>>> From: Sebastian Reichel <[email protected]>
>>>
>>> nvmem_cell_write's buf argument uses different types based on
>>> the configuration of CONFIG_NVMEM. The function prototype for
>>> enabled NVMEM uses 'void *' type, but the static dummy function
>>> for disabled NVMEM uses 'const char *' instead. Fix the different
>>> behaviour by always expecting a 'void *' typed buf argument.
>>>
>>> Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
>>> Reported-by: kbuild test robot <[email protected]>
>>> Cc: Han Nandor <[email protected]>
>>> Cc: Srinivas Kandagatla <[email protected]>
>>> Cc: [email protected]
>>> Signed-off-by: Sebastian Reichel <[email protected]>
>>> ---
>>> include/linux/nvmem-consumer.h | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
>>> index 8f8be5b00060..5c17cb733224 100644
>>> --- a/include/linux/nvmem-consumer.h
>>> +++ b/include/linux/nvmem-consumer.h
>>> @@ -118,7 +118,7 @@ static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>>> }
>>> static inline int nvmem_cell_write(struct nvmem_cell *cell,
>>> - const char *buf, size_t len)
>>> + void *buf, size_t len)
>>
>> nitpick: alignment issue?
>
> This actually fixes the alignment issue as a side-effect.
> I guess I should have mentioned it in the changelog.
>
>> Review-By: Han Nandor <[email protected]>
>
> I suppose you meant to write "Reviewed-by" instead of inventing your
> own tag?
>

Yes :)

Nandor


2019-09-17 09:45:45

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] nvmem: core: fix nvmem_cell_write inline function

On Mon, Sep 9, 2019 at 3:45 PM Sebastian Reichel <[email protected]> wrote:
>
> From: Sebastian Reichel <[email protected]>
>
> nvmem_cell_write's buf argument uses different types based on
> the configuration of CONFIG_NVMEM. The function prototype for
> enabled NVMEM uses 'void *' type, but the static dummy function
> for disabled NVMEM uses 'const char *' instead. Fix the different
> behaviour by always expecting a 'void *' typed buf argument.
>
> Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
> Reported-by: kbuild test robot <[email protected]>
> Cc: Han Nandor <[email protected]>
> Cc: Srinivas Kandagatla <[email protected]>
> Cc: [email protected]
> Signed-off-by: Sebastian Reichel <[email protected]>

I still see the issue in linux-next, did this get dropped by accident?

Arnd

2019-09-17 09:48:47

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH] nvmem: core: fix nvmem_cell_write inline function



On 17/09/2019 08:57, Arnd Bergmann wrote:
> On Mon, Sep 9, 2019 at 3:45 PM Sebastian Reichel <[email protected]> wrote:
>>
>> From: Sebastian Reichel <[email protected]>
>>
>> nvmem_cell_write's buf argument uses different types based on
>> the configuration of CONFIG_NVMEM. The function prototype for
>> enabled NVMEM uses 'void *' type, but the static dummy function
>> for disabled NVMEM uses 'const char *' instead. Fix the different
>> behaviour by always expecting a 'void *' typed buf argument.
>>
>> Fixes: 7a78a7f7695b ("power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface")
>> Reported-by: kbuild test robot <[email protected]>
>> Cc: Han Nandor <[email protected]>
>> Cc: Srinivas Kandagatla <[email protected]>
>> Cc: [email protected]
>> Signed-off-by: Sebastian Reichel <[email protected]>
>
> I still see the issue in linux-next, did this get dropped by accident?
>

I just pushed it to nvmem tree, should be fixed in next soon!

--srini
> Arnd
>