public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
@ 2015-09-18  9:50 Axel Lin
  2015-09-18  9:58 ` Srinivas Kandagatla
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-09-18  9:50 UTC (permalink / raw)
  To: Srinivas Kandagatla, Maxime Ripard; +Cc: linux-kernel

It's pointless to test (cell->bit_offset || cell->bit_offset).
nvmem_shift_read_buffer_in_place() should be called when
(cell->bit_offset || cell->nbits).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/nvmem/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d3c6676..c39723a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
 		return rc;
 
 	/* shift bits in-place */
-	if (cell->bit_offset || cell->bit_offset)
+	if (cell->bit_offset || cell->nbits)
 		nvmem_shift_read_buffer_in_place(cell, buf);
 
 	*len = cell->bytes;
-- 
2.1.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
  2015-09-18  9:50 [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero Axel Lin
@ 2015-09-18  9:58 ` Srinivas Kandagatla
  0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2015-09-18  9:58 UTC (permalink / raw)
  To: Axel Lin, Maxime Ripard; +Cc: linux-kernel

Hi Axel,
Thanks for the patch

Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


I remember fixing this sometime back which was reported by static 
checker reported by Dan Carpenter, I forgot to send it over to wider 
audience. Thanks for reminding.


--srini
On 18/09/15 10:50, Axel Lin wrote:
> It's pointless to test (cell->bit_offset || cell->bit_offset).
> nvmem_shift_read_buffer_in_place() should be called when
> (cell->bit_offset || cell->nbits).
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/nvmem/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index d3c6676..c39723a 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
>   		return rc;
>
>   	/* shift bits in-place */
> -	if (cell->bit_offset || cell->bit_offset)
> +	if (cell->bit_offset || cell->nbits)
>   		nvmem_shift_read_buffer_in_place(cell, buf);
>
>   	*len = cell->bytes;
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-18  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18  9:50 [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero Axel Lin
2015-09-18  9:58 ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox