diff mbox series

[net,v2,1/3] net: mdio-mux: Delete unnecessary devm_kfree

Message ID 20210817180841.3210484-2-saravanak@google.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Clean up and fix error handling in mdio_mux_init() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Saravana Kannan Aug. 17, 2021, 6:08 p.m. UTC
The whole point of devm_* APIs is that you don't have to undo them if you
are returning an error that's going to get propagated out of a probe()
function. So delete unnecessary devm_kfree() call in the error return path.

Signed-off-by: Saravana Kannan <saravanak@google.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
---
 drivers/net/mdio/mdio-mux.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Andrew Lunn Aug. 17, 2021, 9:10 p.m. UTC | #1
On Tue, Aug 17, 2021 at 11:08:39AM -0700, Saravana Kannan wrote:
> The whole point of devm_* APIs is that you don't have to undo them if you
> are returning an error that's going to get propagated out of a probe()
> function. So delete unnecessary devm_kfree() call in the error return path.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Acked-by: Marc Zyngier <maz@kernel.org>
> Tested-by: Marc Zyngier <maz@kernel.org>
> Acked-by: Kevin Hilman <khilman@baylibre.com>
> Tested-by: Kevin Hilman <khilman@baylibre.com>

Please add a Fixes: tag, since you want this in stable.

All three patches need fixes tags, possibly different for each patch?

       Andrew
Saravana Kannan Aug. 18, 2021, 2:56 a.m. UTC | #2
On Tue, Aug 17, 2021 at 2:10 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Tue, Aug 17, 2021 at 11:08:39AM -0700, Saravana Kannan wrote:
> > The whole point of devm_* APIs is that you don't have to undo them if you
> > are returning an error that's going to get propagated out of a probe()
> > function. So delete unnecessary devm_kfree() call in the error return path.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> > Acked-by: Marc Zyngier <maz@kernel.org>
> > Tested-by: Marc Zyngier <maz@kernel.org>
> > Acked-by: Kevin Hilman <khilman@baylibre.com>
> > Tested-by: Kevin Hilman <khilman@baylibre.com>
>
> Please add a Fixes: tag, since you want this in stable.
>
> All three patches need fixes tags, possibly different for each patch?

I generally ask for patches to be picked up by stable only if it fixes
a bug that puts the kernel in a bad state or if it fixes an issue
someone actually reported on the stable kernel. In this case, it's
just failing device probes in some cases and I didn't think that met
the bar for stable. But if you think they should, then that's fine by
me.

I'll send out v3 patches with Fixes. I'm fairly sure these issues were
present since the time mdio-mux was added. Hopefully v3 will be the
last version I have to send out :)

-Saravana
Andrew Lunn Aug. 18, 2021, 6:46 p.m. UTC | #3
On Tue, Aug 17, 2021 at 07:56:42PM -0700, Saravana Kannan wrote:
> On Tue, Aug 17, 2021 at 2:10 PM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Tue, Aug 17, 2021 at 11:08:39AM -0700, Saravana Kannan wrote:
> > > The whole point of devm_* APIs is that you don't have to undo them if you
> > > are returning an error that's going to get propagated out of a probe()
> > > function. So delete unnecessary devm_kfree() call in the error return path.
> > >
> > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> > > Acked-by: Marc Zyngier <maz@kernel.org>
> > > Tested-by: Marc Zyngier <maz@kernel.org>
> > > Acked-by: Kevin Hilman <khilman@baylibre.com>
> > > Tested-by: Kevin Hilman <khilman@baylibre.com>
> >
> > Please add a Fixes: tag, since you want this in stable.
> >
> > All three patches need fixes tags, possibly different for each patch?
> 
> I generally ask for patches to be picked up by stable only if it fixes
> a bug that puts the kernel in a bad state

Actually, you asked for stable. You set the subject to

[PATCH net v3 0/3] Clean up and fix error

where [PATCH net ] means stable. If you think this is just ongoing
development work, use [PATCH net-next ]. Then the Fixes tags are
optional.

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c
index 110e4ee85785..5b37284f54d6 100644
--- a/drivers/net/mdio/mdio-mux.c
+++ b/drivers/net/mdio/mdio-mux.c
@@ -181,7 +181,6 @@  int mdio_mux_init(struct device *dev,
 	}
 
 	dev_err(dev, "Error: No acceptable child buses found\n");
-	devm_kfree(dev, pb);
 err_pb_kz:
 	put_device(&parent_bus->dev);
 err_parent_bus: