Thread (12 messages) flat view 12 messages, 3 authors, 2005-08-16

Re: [PATCH] identify_ppc_sys_by_name_and_id function implementation final

From: Marcelo Tosatti <hidden>
Date: 2005-08-11 05:35:46

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:
quoted
Finally correct indentation style.

Signed-off-by: Vitaly Bordug <redacted>
quoted
quoted
-- 
Sincerely,
Vitaly

<ppc_sys_add.patch>
<ATT87954.txt>
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help