From: York Sun Date: Sat, 15 Apr 2017 09:43:11 -0700 Subject: [U-Boot] [PATCH] ddr: fsl: incorrect logical constraint in populate_memctl_options In-Reply-To: <20170415132349.25841-1-xypron.glpk@gmx.de> References: <20170415132349.25841-1-xypron.glpk@gmx.de> Message-ID: <5adb7b7c-c4f5-a3ac-8447-8b4ce38e07e7@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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