[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a6ff399-b394-e6c0-9d03-a48faf5670b7@csgroup.eu>
Date: Wed, 20 Jan 2021 12:30:14 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
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
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
Powered by blists - more mailing lists