* Re: [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put
[not found] <201904081455561126540@zte.com.cn>
@ 2019-04-08 7:37 ` Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2019-04-08 7:37 UTC (permalink / raw)
To: Wen Yang, linux-arm-kernel, linux-mediatek, linux-wireless,
netdev
Cc: UNGLinuxDriver, Alexandre Belloni, Andrew Lunn, Anirudha Sarangi,
David S. Miller, Florian Fainelli, Kalle Valo, Linus Walleij,
Lorenzo Bianconi, Matthias Brugger, Michal Simek, Felix Fietkau,
Vivien Didelot, John Linn, Yi Wang, linux-kernel
>>> @@ -54,22 +54,30 @@ mt76_get_of_eeprom(struct mt76_dev *dev, int len)
>>> part = np->name;
>>>
>>> mtd = get_mtd_device_nm(part);
>> …
>>> + if (retlen < len) {
>>> + ret = -EINVAL;
>>> + goto out_put_node;
>>
>> I find a jump to an immediately following source code place unnecessary.
>> Would you like to delete it?
>>
>>
>>> + }
>>>
>>> - return 0;
>>> +out_put_node:
>>> + of_node_put(np);
>>> + return ret;
>>> #else
>>
>> Can another bit of fine-tuning matter here?
>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/net/wireless/mediatek/mt76/eeprom.c?id=34e022d8b780a03902d82fb3997ba7c7b1f40c81#n73
…
> We may have some different opinions here.
Obviously, yes for this implementation detail.
> Deleting the goto statement may not be good.
I find such an adjustment helpful here.
> If the code further up is changed it's easy enough to miss
> that a goto statement needs to be added here.
There are the usual consequences to consider for every change.
> Better to set ret to zero explicitly, this is the success path after all.
I disagree to this information because the variable was set to
the return value from a call of the function “mtd_read” already.
Regards,
Markus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-08 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201904081455561126540@zte.com.cn>
2019-04-08 7:37 ` [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).