From eba042a81edd6baaff44831b2d719b14a6d21e58 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Tue, 25 May 2010 18:21:07 +0200 Subject: edac, mc: Improve scrub rate handling Fortify the interface to not accept negative values, remove memctrl_int_store() as a result. Also, sanitize bandwidth setting by making the argument a simple u32 instead of strange u32 pointer being passed around for no obvious reason. Then, fix error handling and teach it to return proper error values. Finally, make code more readable, simplify debug messages. Cc: Mauro Carvalho Chehab Cc: Arthur Jones Signed-off-by: Borislav Petkov Acked-by: Doug Thompson --- drivers/edac/e752x_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/edac/e752x_edac.c') diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c index ae3f80c..073f5a0 100644 --- a/drivers/edac/e752x_edac.c +++ b/drivers/edac/e752x_edac.c @@ -958,7 +958,7 @@ static void e752x_check(struct mem_ctl_info *mci) } /* Program byte/sec bandwidth scrub rate to hardware */ -static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw) +static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 new_bw) { const struct scrubrate *scrubrates; struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info; @@ -975,7 +975,7 @@ static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw) * desired rate and program the cooresponding register value. */ for (i = 0; scrubrates[i].bandwidth != SDRATE_EOT; i++) - if (scrubrates[i].bandwidth >= *new_bw) + if (scrubrates[i].bandwidth >= new_bw) break; if (scrubrates[i].bandwidth == SDRATE_EOT) -- cgit v1.1