Skip to content

Commit e840774

Browse files
Eliav Farberbp3tk0v
authored andcommitted
EDAC/device: Fix period calculation in edac_device_reset_delay_period()
Fix period calculation in case user sets a value of 1000. The input of round_jiffies_relative() should be in jiffies and not in milli-seconds. [ bp: Use the same code pattern as in edac_device_workq_setup() for clarity. ] Fixes: c4cf3b4 ("EDAC: Rework workqueue handling") Signed-off-by: Eliav Farber <farbere@amazon.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: <stable@kernel.org> Link: https://lore.kernel.org/r/20221020124458.22153-1-farbere@amazon.com
1 parent 1b929c0 commit e840774

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/edac/edac_device.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,16 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
394394
* Then restart the workq on the new delay
395395
*/
396396
void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
397-
unsigned long value)
397+
unsigned long msec)
398398
{
399-
unsigned long jiffs = msecs_to_jiffies(value);
400-
401-
if (value == 1000)
402-
jiffs = round_jiffies_relative(value);
403-
404-
edac_dev->poll_msec = value;
405-
edac_dev->delay = jiffs;
399+
edac_dev->poll_msec = msec;
400+
edac_dev->delay = msecs_to_jiffies(msec);
406401

407-
edac_mod_work(&edac_dev->work, jiffs);
402+
/* See comment in edac_device_workq_setup() above */
403+
if (edac_dev->poll_msec == 1000)
404+
edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
405+
else
406+
edac_mod_work(&edac_dev->work, edac_dev->delay);
408407
}
409408

410409
int edac_device_alloc_index(void)

drivers/edac/edac_module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool edac_stop_work(struct delayed_work *work);
5353
bool edac_mod_work(struct delayed_work *work, unsigned long delay);
5454

5555
extern void edac_device_reset_delay_period(struct edac_device_ctl_info
56-
*edac_dev, unsigned long value);
56+
*edac_dev, unsigned long msec);
5757
extern void edac_mc_reset_delay_period(unsigned long value);
5858

5959
/*

0 commit comments

Comments
 (0)