[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <582b6ef6-e913-5aaa-61d4-de75c96abb8b@prevas.dk>
Date: Wed, 20 Jan 2021 12:25:02 +0100
From: Rasmus Villemoes <rasmus.villemoes@...vas.dk>
To: Christophe Leroy <christophe.leroy@...roup.eu>,
netdev@...r.kernel.org
Cc: Li Yang <leoyang.li@....com>,
"David S . Miller" <davem@...emloft.net>,
Zhao Qiang <qiang.zhao@....com>, Andrew Lunn <andrew@...n.ch>,
Jakub Kicinski <kuba@...nel.org>,
Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
Subject: Re: [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically
allocate eight ucc_geth_info
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.
Rasmus
Powered by blists - more mailing lists