* [PATCH] tx4938ide: Avoid underflow on calculation of a wait cycle
@ 2008-10-28 13:09 Atsushi Nemoto
2008-10-29 19:20 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2008-10-28 13:09 UTC (permalink / raw)
To: linux-mips; +Cc: linux-ide, Bartlomiej Zolnierkiewicz, ralf, sshtylyov
Make 'wt' variable signed while it can be negative during calculation.
Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/ide/tx4938ide.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 796289c..9120063 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -26,12 +26,13 @@ static void tx4938ide_tune_ebusc(unsigned int ebus_ch,
unsigned int sp = (cr >> 4) & 3;
unsigned int clock = gbus_clock / (4 - sp);
unsigned int cycle = 1000000000 / clock;
- unsigned int wt, shwt;
+ unsigned int shwt;
+ int wt;
/* Minimum DIOx- active time */
wt = DIV_ROUND_UP(t->act8b, cycle) - 2;
/* IORDY setup time: 35ns */
- wt = max(wt, DIV_ROUND_UP(35, cycle));
+ wt = max_t(int, wt, DIV_ROUND_UP(35, cycle));
/* actual wait-cycle is max(wt & ~1, 1) */
if (wt > 2 && (wt & 1))
wt++;
--
1.5.6.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tx4938ide: Avoid underflow on calculation of a wait cycle
2008-10-28 13:09 [PATCH] tx4938ide: Avoid underflow on calculation of a wait cycle Atsushi Nemoto
@ 2008-10-29 19:20 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-10-29 19:20 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips, linux-ide, ralf, sshtylyov
On Tuesday 28 October 2008, Atsushi Nemoto wrote:
> Make 'wt' variable signed while it can be negative during calculation.
>
> Suggested-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-29 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-28 13:09 [PATCH] tx4938ide: Avoid underflow on calculation of a wait cycle Atsushi Nemoto
2008-10-29 19:20 ` Bartlomiej Zolnierkiewicz
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).