netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Wen Yang <wen.yang99@zte.com.cn>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: UNGLinuxDriver@microchip.com,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Anirudha Sarangi <anirudh@xilinx.com>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Felix Fietkau <nbd@nbd.name>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	John Linn <John.Linn@xilinx.com>, Yi Wang <wang.yi59@zte.com.cn>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put
Date: Mon, 8 Apr 2019 09:37:24 +0200	[thread overview]
Message-ID: <63a3b39a-0b01-f224-3c1c-d142519b7dd7@web.de> (raw)
In-Reply-To: <201904081455561126540@zte.com.cn>

>>> @@ -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

           reply	other threads:[~2019-04-08  7:38 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <201904081455561126540@zte.com.cn>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63a3b39a-0b01-f224-3c1c-d142519b7dd7@web.de \
    --to=markus.elfring@web.de \
    --cc=John.Linn@xilinx.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=anirudh@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=michal.simek@xilinx.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    --cc=wang.yi59@zte.com.cn \
    --cc=wen.yang99@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).