All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Kumar Gala <kumar.gala@freescale.com>
Cc: linuxppc-embedded list <linuxppc-embedded@ozlabs.org>
Subject: Re: [PATCH] identify_ppc_sys_by_name_and_id function implementation final
Date: Thu, 11 Aug 2005 02:30:32 -0300	[thread overview]
Message-ID: <20050811053032.GF5665@dmt.cnet> (raw)
In-Reply-To: <4BA092C9-1517-416E-9C98-90F9D8F41857@freescale.com>

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@ru.mvista.com>
> >> >-- 
> >Sincerely,
> >Vitaly
> >
> ><ppc_sys_add.patch>
> ><ATT87954.txt>
> >
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

  reply	other threads:[~2005-08-11  5:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-10 17:15 [RFC][PATCH] identify_ppc_sys_by_name_and_id function implementation Vitaly Bordug
2005-08-10 17:46 ` [PATCH] identify_ppc_sys_by_name_and_id function implementation (braces fixed) Vitaly Bordug
2005-08-10 18:01   ` [PATCH] identify_ppc_sys_by_name_and_id function implementation final Vitaly Bordug
2005-08-10 19:16     ` Kumar Gala
2005-08-11  5:30       ` Marcelo Tosatti [this message]
2005-08-11 15:25         ` Vitaly Bordug
2005-08-11 22:45           ` Marcelo Tosatti
2005-08-12 15:37             ` Vitaly Bordug
2005-08-12 16:18               ` Kumar Gala
2005-08-12 16:30                 ` Vitaly Bordug
2005-08-12 19:48                   ` Kumar Gala
2005-08-16 13:36                     ` Vitaly Bordug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050811053032.GF5665@dmt.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=kumar.gala@freescale.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.