Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1227735 > unrolled thread

[PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero

Started byAxel Lin <axel.lin@ingics.com>
First post2015-09-18 12:00 +0200
Last post2015-09-18 12:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is  non-zero Axel Lin <axel.lin@ingics.com> - 2015-09-18 12:00 +0200
    Re: [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits  is non-zero Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-09-18 12:00 +0200

#1227735 — [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero

FromAxel Lin <axel.lin@ingics.com>
Date2015-09-18 12:00 +0200
Subject[PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
Message-ID<qa0Cv-7v5-35@gated-at.bofh.it>
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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227736 — Re: [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2015-09-18 12:00 +0200
SubjectRe: [PATCH] nvmem: core: Handle shift bits in-place if cell->nbits is non-zero
Message-ID<qa0Cv-7v5-39@gated-at.bofh.it>
In reply to#1227735
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;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web