[coreboot] [patch][msrtool] Add K8 MSRs

Marc Jones marcj303 at gmail.com
Sun Mar 8 05:38:08 CET 2009


On Fri, Mar 6, 2009 at 2:15 PM, Peter Stuge <peter at stuge.se> wrote:
> Stefan Reinauer wrote:
>> >>> -const uint32_t msraddrbyname(const char *name) {
>> >
>> > That was to get it to compile with -Werror which is on by
>> > default. It didn't look like that really needed to be a const.
>>
>> Does the const make sense at all? It seems odd to define the
>> variable integer return value of a function const. What's that
>> supposed to be good for?
>
> The value returned in the function is const. Is it OK to still have
> the function return non-const?
>
> msrtool.h:
>
> struct msrdef {
>        const uint32_t addr;
>
>
> msrutils.c:
>
> if (addr == m->addr)
>        return m->addr;
> if (!strcasecmp(name, m->symbol))
>        return m->addr;
>
>
> If I just made a too conservative assumption about types, I am all
> for!
>
> Acked-by: Peter Stuge <peter at stuge.se>

Yes, That doesn't seem to bother the type checking but having the
return type not match the variable causes an error (warning).

r3985

Thanks,
Marc




More information about the coreboot mailing list