linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] edac i5000, i5400: fix use of MTR_DRAM_WIDTH macro
@ 2017-03-09  1:18 Jérémy Lefaure
  2017-03-09  8:35 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Jérémy Lefaure @ 2017-03-09  1:18 UTC (permalink / raw)
  To: Borislav Petkov, Mauro Carvalho Chehab
  Cc: linux-edac, linux-kernel, Jérémy Lefaure

The MTR_DRAM_WIDTH macro returns the data width. It is sometimes used as
if it returned a boolean true if the width if 8. This patch fixes the
tests where MTR_DRAM_WIDTH is misused.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
---
 drivers/edac/i5000_edac.c | 2 +-
 drivers/edac/i5400_edac.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 1670d27bcac8..f683919981b0 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1293,7 +1293,7 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)
 			dimm->mtype = MEM_FB_DDR2;
 
 			/* ask what device type on this row */
-			if (MTR_DRAM_WIDTH(mtr))
+			if (MTR_DRAM_WIDTH(mtr) == 8)
 				dimm->dtype = DEV_X8;
 			else
 				dimm->dtype = DEV_X4;
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index abf6ef22e220..37a9ba71da44 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -1207,13 +1207,14 @@ static int i5400_init_dimms(struct mem_ctl_info *mci)
 
 			dimm->nr_pages = size_mb << 8;
 			dimm->grain = 8;
-			dimm->dtype = MTR_DRAM_WIDTH(mtr) ? DEV_X8 : DEV_X4;
+			dimm->dtype = MTR_DRAM_WIDTH(mtr) == 8 ?
+				      DEV_X8 : DEV_X4;
 			dimm->mtype = MEM_FB_DDR2;
 			/*
 			 * The eccc mechanism is SDDC (aka SECC), with
 			 * is similar to Chipkill.
 			 */
-			dimm->edac_mode = MTR_DRAM_WIDTH(mtr) ?
+			dimm->edac_mode = MTR_DRAM_WIDTH(mtr) == 8 ?
 					  EDAC_S8ECD8ED : EDAC_S4ECD4ED;
 			ndimms++;
 		}
-- 
2.12.0

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

* Re: [PATCH] edac i5000, i5400: fix use of MTR_DRAM_WIDTH macro
  2017-03-09  1:18 [PATCH] edac i5000, i5400: fix use of MTR_DRAM_WIDTH macro Jérémy Lefaure
@ 2017-03-09  8:35 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2017-03-09  8:35 UTC (permalink / raw)
  To: Jérémy Lefaure; +Cc: Mauro Carvalho Chehab, linux-edac, linux-kernel

On Wed, Mar 08, 2017 at 08:18:09PM -0500, Jérémy Lefaure wrote:
> The MTR_DRAM_WIDTH macro returns the data width. It is sometimes used as
> if it returned a boolean true if the width if 8. This patch fixes the
> tests where MTR_DRAM_WIDTH is misused.
> 
> Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
> ---
>  drivers/edac/i5000_edac.c | 2 +-
>  drivers/edac/i5400_edac.c | 5 +++--
>  2 files changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

end of thread, other threads:[~2017-03-09  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09  1:18 [PATCH] edac i5000, i5400: fix use of MTR_DRAM_WIDTH macro Jérémy Lefaure
2017-03-09  8:35 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).