]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: ras-mc-ctl: Fix script to parse dimm sizes
authorMuralidhara M K <muralimk@amd.com>
Tue, 27 Jul 2021 11:36:45 +0000 (06:36 -0500)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 1 Apr 2022 08:53:04 +0000 (10:53 +0200)
Removes trailing spaces at the end of a line from
file location and fixes --layout option to parse dimm nodes
to get the size of each dimm from ras-mc-ctl.

Issue is reported https://github.com/mchehab/rasdaemon/issues/43
Where '> ras-mc-ctl --layout' reports all 0s

With this change the layout option prints the correct dimm sizes
> sudo ras-mc-ctl --layout
          +-----------------------------------------------+
          |                      mc0                      |
          |  csrow0   |  csrow1   |  csrow2   |  csrow3   |
----------+-----------------------------------------------+
...
channel7: |  16384 MB  |     0 MB  |     0 MB  |     0 MB |
channel6: |  16384 MB  |     0 MB  |     0 MB  |     0 MB |
...
----------+-----------------------------------------------+

Signed-off-by: Muralidhara M K <muralimk@amd.com>
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lkml.kernel.org/r/20210810183855.129076-1-nchatrad@amd.com/
util/ras-mc-ctl.in

index 1e3aeb7e25152fd89b0c217ae5bee1b2a2f9ad13..b22dd60b2cbd9c8b80fd3fa6aa8c4369d9ed2eea 100755 (executable)
@@ -246,6 +246,7 @@ sub parse_dimm_nodes
     if (($file =~ /max_location$/)) {
         open IN, $file;
         my $location = <IN>;
+        $location =~ s/\s+$//;
         close IN;
         my @temp = split(/ /, $location);
 
@@ -288,6 +289,7 @@ sub parse_dimm_nodes
 
         open IN, $file;
         my $location = <IN>;
+        $location =~ s/\s+$//;
         close IN;
 
         my @pos;