All of lore.kernel.org
 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

WARNING: multiple messages have this Message-ID (diff)
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: Yi Wang <wang.yi59@zte.com.cn>, Andrew Lunn <andrew@lunn.ch>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Michal Simek <michal.simek@xilinx.com>,
	UNGLinuxDriver@microchip.com,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Anirudha Sarangi <anirudh@xilinx.com>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	John Linn <John.Linn@xilinx.com>,
	"David S. Miller" <davem@davemloft.net>,
	Kalle Valo <kvalo@codeaurora.org>, Felix Fietkau <nbd@nbd.name>
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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22  7:15 [PATCH 1/5] net: dsa: fix a leaked reference by adding a missing of_node_put Wen Yang
2019-02-22  7:15 ` Wen Yang
2019-02-22  7:15 ` [PATCH 2/5] net: mscc: ocelot: " Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-22  7:15 ` [PATCH 3/5] mt76: " Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-28  8:39   ` Kalle Valo
2019-02-28  8:39     ` Kalle Valo
2019-02-28  8:39   ` Kalle Valo
2019-02-28  8:39     ` Kalle Valo
2019-04-05 13:15   ` Markus Elfring
2019-04-05 13:15     ` Markus Elfring
     [not found]     ` <799adbb0-23a6-bf20-f22d-4af68e9d0012-S0/GAf8tV78@public.gmane.org>
2019-04-08  6:55       ` [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put wen.yang99-Th6q7B73Y6EnDS1+zs4M5A
2019-04-08  7:37         ` Markus Elfring [this message]
2019-04-08  7:37           ` Markus Elfring
2019-02-22  7:15 ` [PATCH 4/5] net: xilinx: fix a leaked reference by adding missing of_node_put Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-22  7:15 ` [PATCH 5/5] net: dsa: " Wen Yang
2019-02-22  7:15   ` Wen Yang
2019-02-24 20:32   ` David Miller
2019-02-24 20:32     ` David Miller
2019-02-22 10:38 ` [PATCH 1/5] net: dsa: fix a leaked reference by adding a " Linus Walleij
2019-02-22 10:38   ` Linus Walleij
2019-02-22 10:38   ` Linus Walleij

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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.