[PATCH] identify_ppc_sys_by_name_and_id function implementation final
Marcelo Tosatti
marcelo.tosatti at cyclades.com
Thu Aug 11 15:30:32 EST 2005
On Wed, Aug 10, 2005 at 02:16:57PM -0500, Kumar Gala wrote:
> +static int __init find_chip_by_name_and_id(char *name, u32 id)
> +{
> + int ret = -1;
> + unsigned int i = 0;
> + unsigned int j = 0;
> + unsigned int dups = 0;
> +
> + unsigned int matched[count_sys_specs()];
>
> Is is legit in the kernel to use dynamically sized array?
kmalloc() is certainly safer - why not use it?
> +
> + while (strcmp(ppc_sys_specs[i].ppc_sys_name, "")) {
> + if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name))
> + matched[j++] = i;
> + i++;
> + }
> + if (j != 0) {
> + for (i = 0; i < j; i++) {
> + if ((ppc_sys_specs[matched[i]].mask & id) ==
> + ppc_sys_specs[matched[i]].value) {
> + ret = matched[i];
> + dups++;
> + }
> + }
> + ret = (dups == 1) ? ret : (-1 * dups);
> + }
> + return ret;
> +}
>
> On Aug 10, 2005, at 1:01 PM, Vitaly Bordug wrote:
>
> >Finally correct indentation style.
> >
> >Signed-off-by: Vitaly Bordug <vbordug at ru.mvista.com>
> >> >--
> >Sincerely,
> >Vitaly
> >
> ><ppc_sys_add.patch>
> ><ATT87954.txt>
> >
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
More information about the Linuxppc-embedded
mailing list