From: <wen.yang99-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
To: Markus.Elfring-S0/GAf8tV78@public.gmane.org
Cc: wang.yi59-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org,
andrew-g2DYL2Zd6BY@public.gmane.org,
alexandre.belloni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org,
UNGLinuxDriver-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
anirudh-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org,
lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
vivien.didelot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
John.Linn-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org,
davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
nbd-Vt+b4OUoWG0@public.gmane.org
Subject: Re: [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put
Date: Mon, 8 Apr 2019 14:55:56 +0800 (CST) [thread overview]
Message-ID: <201904081455561126540@zte.com.cn> (raw)
In-Reply-To: <799adbb0-23a6-bf20-f22d-4af68e9d0012-S0/GAf8tV78@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1307 bytes --]
> > @@ -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
>
Hi Markus,
Thank you for your comments.
We may have some different opinions here.
Deleting the goto statement may not be good.
If the code further up is changed it's easy enough to miss that a goto statement needs to be added here.
Better to set ret to zero explicitly, this is the success path after all.
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -75,6 +75,8 @@ mt76_get_of_eeprom(struct mt76_dev *dev, int len)
goto out_put_node;
}
+ ret = 0;
+
out_put_node:
of_node_put(np);
return ret;
--
Regards,
Wen
[-- Attachment #2: Type: text/plain, Size: 200 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2019-04-08 6:55 UTC|newest]
Thread overview: 12+ 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 ` [PATCH 3/5] mt76: " Wen Yang
2019-02-28 8:39 ` Kalle Valo
2019-02-28 8:39 ` Kalle Valo
2019-04-05 13:15 ` Markus Elfring
[not found] ` <799adbb0-23a6-bf20-f22d-4af68e9d0012-S0/GAf8tV78@public.gmane.org>
2019-04-08 6:55 ` wen.yang99-Th6q7B73Y6EnDS1+zs4M5A [this message]
2019-04-08 7:37 ` [PATCH 3/5] mt76: fix a leaked reference by adding a missingof_node_put Markus Elfring
[not found] ` <1550819742-32155-1-git-send-email-wen.yang99-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
2019-02-22 7:15 ` [PATCH 2/5] net: mscc: ocelot: fix a leaked reference by adding a missing of_node_put Wen Yang
2019-02-22 7:15 ` [PATCH 4/5] net: xilinx: fix a leaked reference by adding " Wen Yang
2019-02-22 10:38 ` [PATCH 1/5] net: dsa: fix a leaked reference by adding a " Linus Walleij
2019-02-22 7:15 ` [PATCH 5/5] net: dsa: fix a leaked reference by adding " Wen Yang
2019-02-24 20:32 ` David Miller
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=201904081455561126540@zte.com.cn \
--to=wen.yang99-th6q7b73y6ends1+zs4m5a@public.gmane.org \
--cc=John.Linn-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
--cc=Markus.Elfring-S0/GAf8tV78@public.gmane.org \
--cc=UNGLinuxDriver-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org \
--cc=alexandre.belloni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=anirudh-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
--cc=nbd-Vt+b4OUoWG0@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vivien.didelot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wang.yi59-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org \
/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).