Thread (31 messages) flat view 31 messages, 4 authors, 2021-01-21

Re: [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

From: Rasmus Villemoes <hidden>
Date: 2021-01-20 12:46:41

On 20/01/2021 08.02, Christophe Leroy wrote:
quoted
@@ -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.

Rasmus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help