From: Leon Romanovsky <leon@kernel.org> To: Yuan Can <yuancan@huawei.com> Cc: nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, sujuan.chen@mediatek.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init() Date: Sun, 4 Dec 2022 14:32:44 +0200 [thread overview] Message-ID: <Y4yTbO0+7MmhTvVT@unreal> (raw) In-Reply-To: <20221202083029.87834-1-yuancan@huawei.com> On Fri, Dec 02, 2022 at 08:30:29AM +0000, Yuan Can wrote: > The np needs to be released through of_node_put() in the error handling > path of mtk_wed_wo_hardware_init(). > > Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support") > Signed-off-by: Yuan Can <yuancan@huawei.com> > --- > drivers/net/ethernet/mediatek/mtk_wed_wo.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Please use [PATCH net-next] ... format in title. > > diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c > index 4754b6db009e..d61bd0b11331 100644 > --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c > +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c > @@ -407,8 +407,10 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo) > return -ENODEV; > > wo->mmio.regs = syscon_regmap_lookup_by_phandle(np, NULL); > - if (IS_ERR_OR_NULL(wo->mmio.regs)) syscon_regmap_lookup_by_phandle() returns or error or valid pointer. The right check needs to be IS_ERR(wo->mmio.regs) Thanks > - return PTR_ERR(wo->mmio.regs); > + if (IS_ERR_OR_NULL(wo->mmio.regs)) { > + ret = PTR_ERR(wo->mmio.regs); > + goto error_put; > + } > > wo->mmio.irq = irq_of_parse_and_map(np, 0); > wo->mmio.irq_mask = MTK_WED_WO_ALL_INT_MASK; > @@ -456,7 +458,8 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo) > > error: > devm_free_irq(wo->hw->dev, wo->mmio.irq, wo); > - > +error_put: > + of_node_put(np); > return ret; > } > > -- > 2.17.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org> To: Yuan Can <yuancan@huawei.com> Cc: nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, lorenzo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, sujuan.chen@mediatek.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init() Date: Sun, 4 Dec 2022 14:32:44 +0200 [thread overview] Message-ID: <Y4yTbO0+7MmhTvVT@unreal> (raw) In-Reply-To: <20221202083029.87834-1-yuancan@huawei.com> On Fri, Dec 02, 2022 at 08:30:29AM +0000, Yuan Can wrote: > The np needs to be released through of_node_put() in the error handling > path of mtk_wed_wo_hardware_init(). > > Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support") > Signed-off-by: Yuan Can <yuancan@huawei.com> > --- > drivers/net/ethernet/mediatek/mtk_wed_wo.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Please use [PATCH net-next] ... format in title. > > diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c > index 4754b6db009e..d61bd0b11331 100644 > --- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c > +++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c > @@ -407,8 +407,10 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo) > return -ENODEV; > > wo->mmio.regs = syscon_regmap_lookup_by_phandle(np, NULL); > - if (IS_ERR_OR_NULL(wo->mmio.regs)) syscon_regmap_lookup_by_phandle() returns or error or valid pointer. The right check needs to be IS_ERR(wo->mmio.regs) Thanks > - return PTR_ERR(wo->mmio.regs); > + if (IS_ERR_OR_NULL(wo->mmio.regs)) { > + ret = PTR_ERR(wo->mmio.regs); > + goto error_put; > + } > > wo->mmio.irq = irq_of_parse_and_map(np, 0); > wo->mmio.irq_mask = MTK_WED_WO_ALL_INT_MASK; > @@ -456,7 +458,8 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo) > > error: > devm_free_irq(wo->hw->dev, wo->mmio.irq, wo); > - > +error_put: > + of_node_put(np); > return ret; > } > > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-12-04 12:33 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-02 8:30 [PATCH] net: ethernet: mtk_wed: Fix missing of_node_put() in mtk_wed_wo_hardware_init() Yuan Can 2022-12-02 8:30 ` Yuan Can 2022-12-04 12:32 ` Leon Romanovsky [this message] 2022-12-04 12:32 ` Leon Romanovsky 2022-12-05 1:58 Yuan Can 2022-12-05 1:58 ` Yuan Can 2022-12-05 3:42 ` Yuan Can 2022-12-05 3:42 ` Yuan Can
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=Y4yTbO0+7MmhTvVT@unreal \ --to=leon@kernel.org \ --cc=Mark-MC.Lee@mediatek.com \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=john@phrozen.org \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=lorenzo@kernel.org \ --cc=matthias.bgg@gmail.com \ --cc=nbd@nbd.name \ --cc=netdev@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=sean.wang@mediatek.com \ --cc=sujuan.chen@mediatek.com \ --cc=yuancan@huawei.com \ /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: linkBe 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.