Skip to contentSkip to conversation

ddr: fsl: incorrect logical constraint in populate_memctl_options

PATCH In review Heinrich Schuchardt 3 participants 4 messages Apr 15, 2017 – Apr 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ddr: fsl: incorrect logical constraint in populate_memctl_options

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

We should use && here.

The problem was indicated by cppcheck.

---
 drivers/ddr/fsl/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/fsl/options.c +1 -1
index d6a8fcb216..cee97fe232 100644
@@ -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 {
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 ddr: fsl: incorrect logical constraint in populate_memctl_options

Quoted 8 lines · Heinrich Schuchardt

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

We should use && here.

The problem was indicated by cppcheck.

Signature · 8 lines
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>
#2 lore raw

PATCH 1/1 ddr: fsl: incorrect logical constraint in populate_memctl_options

In reply to Heinrich Schuchardt
Quoted 18 lines · Heinrich Schuchardt

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

We should use && here.

The problem was indicated by cppcheck.

---
 drivers/ddr/fsl/options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ddr/fsl/options.c +0 -0
index d6a8fcb216..cee97fe232 100644

drivers/ddr/fsl/options.c unsigned int populate_memctl_options(const common_timing_params_t *common_dimm, · line 922

Quoted 8 lines
drivers/ddr/fsl/options.c +1 -1
@@ -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.

#3 lore raw
In reply to Heinrich Schuchardt
Quoted 10 lines · xypron.glpk at gmx.de

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

We should use && here.

The problem was indicated by cppcheck.

Applied to u-boot/master, thanks!

Signature · 8 lines
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>