public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options
@ 2017-04-15 13:23 Heinrich Schuchardt
  2017-04-15 16:12 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Heinrich Schuchardt @ 2017-04-15 13:23 UTC (permalink / raw)
  To: u-boot

(pdimm[0].data_width >= 32) || (pdimm[0].data_width <= 40)
is always true.

We should use && here.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/ddr/fsl/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index d6a8fcb216..cee97fe232 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -916,7 +916,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
 		if ((pdimm[0].data_width >= 64) && \
 			(pdimm[0].data_width <= 72))
 			popts->data_bus_width = 0;
-		else if ((pdimm[0].data_width >= 32) || \
+		else if ((pdimm[0].data_width >= 32) && \
 			(pdimm[0].data_width <= 40))
 			popts->data_bus_width = 1;
 		else {
-- 
2.11.0

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

* [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options
  2017-04-15 13:23 [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options Heinrich Schuchardt
@ 2017-04-15 16:12 ` Tom Rini
  2017-04-15 16:43 ` York Sun
  2017-04-19 13:04 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-04-15 16:12 UTC (permalink / raw)
  To: u-boot

On Sat, Apr 15, 2017 at 03:23:49PM +0200, Heinrich Schuchardt wrote:

> (pdimm[0].data_width >= 32) || (pdimm[0].data_width <= 40)
> is always true.
> 
> We should use && here.
> 
> The problem was indicated by cppcheck.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170415/6f5a60ce/attachment.sig>

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

* [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options
  2017-04-15 13:23 [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options Heinrich Schuchardt
  2017-04-15 16:12 ` Tom Rini
@ 2017-04-15 16:43 ` York Sun
  2017-04-19 13:04 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: York Sun @ 2017-04-15 16:43 UTC (permalink / raw)
  To: u-boot

On 04/15/2017 06:24 AM, Heinrich Schuchardt wrote:
> (pdimm[0].data_width >= 32) || (pdimm[0].data_width <= 40)
> is always true.
>
> We should use && here.
>
> The problem was indicated by cppcheck.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/ddr/fsl/options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
> index d6a8fcb216..cee97fe232 100644
> --- a/drivers/ddr/fsl/options.c
> +++ b/drivers/ddr/fsl/options.c
> @@ -916,7 +916,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
>  		if ((pdimm[0].data_width >= 64) && \
>  			(pdimm[0].data_width <= 72))
>  			popts->data_bus_width = 0;
> -		else if ((pdimm[0].data_width >= 32) || \
> +		else if ((pdimm[0].data_width >= 32) && \
>  			(pdimm[0].data_width <= 40))
>  			popts->data_bus_width = 1;
>  		else {
>

Thanks for catching this.

Reviewed-by: York Sun <york.sun@nxp.com>

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

* [U-Boot] ddr: fsl: incorrect logical constraint in populate_memctl_options
  2017-04-15 13:23 [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options Heinrich Schuchardt
  2017-04-15 16:12 ` Tom Rini
  2017-04-15 16:43 ` York Sun
@ 2017-04-19 13:04 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-04-19 13:04 UTC (permalink / raw)
  To: u-boot

On Sat, Apr 15, 2017 at 03:23:49PM +0200, xypron.glpk at gmx.de wrote:

> (pdimm[0].data_width >= 32) || (pdimm[0].data_width <= 40)
> is always true.
> 
> We should use && here.
> 
> The problem was indicated by cppcheck.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: York Sun <york.sun@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170419/729cd3a2/attachment.sig>

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

end of thread, other threads:[~2017-04-19 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-15 13:23 [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options Heinrich Schuchardt
2017-04-15 16:12 ` Tom Rini
2017-04-15 16:43 ` York Sun
2017-04-19 13:04 ` [U-Boot] " Tom Rini

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