Skip to contentSkip to conversation

sh: build warnings in clock code

U-Boot Mike Frysinger 2 participants 2 messages Feb 15, 2012 – Feb 22, 2012

lore
Share & tools
lore
#0 lore raw

all superh boards hit this warning for me:

Configuring for sh7763rdp board...
time.c: In function 'get_ticks':
time.c:111:16: warning: variable 'ticks' set but not used [-Wunused-but-set- variable]

and indeed, looking at the code, ticks is set but not used. not sure if bug (ticks should be used), or just delete the variable ...

unsigned long long get_ticks (void)

{
    unsigned long tcnt = 0 - readl(TCNT0);
    unsigned long ticks;

    if (last_tcnt > tcnt) { /* overflow */
        overflow_ticks++;
        ticks = (0xffffffff - last_tcnt) + tcnt;
    } else {
        ticks = tcnt;
    }
    last_tcnt = tcnt;

    return (overflow_ticks << 32) | tcnt;
}

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120215/a819d9a8/attachment.pgp>

#1 lore raw

Hi,

Thanks , I will check this and fix.

Best regards,
Nobuhiro

2012/2/16 Mike Frysinger <[email protected]>:

Quoted 32 lines

all superh boards hit this warning for me:

Configuring for sh7763rdp board...
time.c: In function 'get_ticks':
time.c:111:16: warning: variable 'ticks' set but not used [-Wunused-but-set- variable]

and indeed, looking at the code, ticks is set but not used. ?not sure if bug (ticks should be used), or just delete the variable ...

unsigned long long get_ticks (void)
{
? ?unsigned long tcnt = 0 - readl(TCNT0);
? ?unsigned long ticks;

? ?if (last_tcnt > tcnt) { /* overflow */
? ? ? ?overflow_ticks++;
? ? ? ?ticks = (0xffffffff - last_tcnt) + tcnt;
? ?} else {
? ? ? ?ticks = tcnt;
? ?}
? ?last_tcnt = tcnt;

? ?return (overflow_ticks << 32) | tcnt;
}
-mike

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 3 lines
Nobuhiro Iwamatsu
?? iwamatsu at {nigauri.org / debian.org}
?? GPG ID: 40AD1FA6