Re: [Q] warning BUG() related fixing and janitors question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/4/16 Ezequiel García <elezegarcia@xxxxxxxxx>:
> I'll explain better. flat_set_persistent() is used by no-one, except
> from blackfin arch
> where it has something in it. So it gets defined to nothing in every
> architecture, except
> from blackfin.
>
> Now, arch/sh/include/asm/flat.h defines it like:
>
> #define    flag_set_persisten(relval,p)    { (void)p; 0; })
>
> while the rest of them just defines it to zero:
>
> #define    flag_set_persisten(relval,p)    0
>
> This will cause a warning for unused variable p, in fs/binfmt_flat.c
> and IMO the arch/sh is doing it right (just to avoid the warning).
>
> I tested both definitions with bloat-o-metering and it showed no
> extra code.

It's better to replace it with:
static inline int flat_set_persistent(unsigned long relval,
							unsigned long *persistent)
{
	return 0;
}

No warnings, same generated code, type safety.
Look around the code. It's a very common pattern.

Marcin
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux