Le 20/01/2021 à 12:25, Rasmus Villemoes a écrit :
On 20/01/2021 08.02, Christophe Leroy wrote:

@@ -3715,25 +3713,23 @@ static int ucc_geth_probe(struct
platform_device* ofdev)
       if ((ucc_num < 0) || (ucc_num > 7))
           return -ENODEV;
   -    ug_info = &ugeth_info[ucc_num];
-    if (ug_info == NULL) {
-        if (netif_msg_probe(&debug))
-            pr_err("[%d] Missing additional data!\n", ucc_num);
-        return -ENODEV;
-    }
+    ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);

What about using devm_kmalloc() and avoid those kfree and associated goto ?

I already replied to that: I'd rather not mix kmalloc() and
devm_kmalloc() as that makes it much harder to reason about the order in
which stuff gets deallocated. But sure, if you insist.


I didn't remember I already did the same comment, sorry.

Christophe

Reply via email to