Skip to content

Commit

Permalink
i82975x_edac: Test nr_pages earlier to save a few CPU cycles
Browse files Browse the repository at this point in the history
Avoid test nr_pages twice, and initializing some data that won't
be used.

Cleanup patch only.

Reported-by: Aristeu Rozanski Filho <arozansk@redhat.com>
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mauro Carvalho Chehab committed May 28, 2012
1 parent 805afb6 commit 36683aa
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/edac/i82975x_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,
cumul_size);

nr_pages = cumul_size - last_cumul_size;
if (!nr_pages)
continue;

/*
* Initialise dram labels
* index values:
Expand All @@ -420,9 +423,6 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,
for (chan = 0; chan < csrow->nr_channels; chan++) {
dimm = mci->csrows[index].channels[chan].dimm;

if (!nr_pages)
continue;

dimm->nr_pages = nr_pages / csrow->nr_channels;
strncpy(csrow->channels[chan].dimm->label,
labels[(index >> 1) + (chan * 2)],
Expand All @@ -433,9 +433,6 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,
dimm->edac_mode = EDAC_SECDED; /* only supported */
}

if (!nr_pages)
continue; /* not populated */

csrow->first_page = last_cumul_size;
csrow->last_page = cumul_size - 1;
last_cumul_size = cumul_size;
Expand Down

0 comments on commit 36683aa

Please sign in to comment.