phy: uniphier-usb3: no devm for nvmem_cell_get
Subsystems (3)
PATCH 1/1 phy: uniphier-usb3: no devm for nvmem_cell_get
There is absolutely no reason to extend the lifetime of nvmem_cell_get to after removal of the driver. Use and free right after use.
--- drivers/phy/socionext/phy-uniphier-usb3hs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/phy/socionext/phy-uniphier-usb3hs.c +2 -1
@@ -104,11 +104,12 @@ static int uniphier_u3hsphy_get_nvparam(struct uniphier_u3hsphy_priv *priv,struct nvmem_cell *cell;u8 *buf; - cell =devm_nvmem_cell_get (priv->dev, name); + cell =nvmem_cell_get (priv->dev, name);if (IS_ERR (cell))return PTR_ERR (cell); buf =nvmem_cell_read (cell,NULL ); +nvmem_cell_put (cell);if (IS_ERR (buf))return PTR_ERR (buf);
Signature · 1 line
2.53.0
Hi Rosen,
Quoted 18 lines · Rosen Penev
There is absolutely no reason to extend the lifetime of
nvmem_cell_getto after removal of the driver. Use and free right after use.Signed-off-by Rosen Penev <[email protected]>--- drivers/phy/socionext/phy-uniphier-usb3hs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/phy/socionext/phy-uniphier-usb3hs.c +0
-0@@ -104,11 +104,12 @@ static int uniphier_u3hsphy_get_nvparam(structuniphier_u3hsphy_priv *priv, struct nvmem_cell *cell;u8 *buf;
drivers/phy/socionext/phy-uniphier-usb3hs.c static int uniphier_u3hsphy_get_nvparam(struct · line 115
Quoted 10 lines
drivers/phy/socionext/phy-uniphier-usb3hs.c +2
-1- cell =devm_nvmem_cell_get (priv->dev, name); + cell =nvmem_cell_get (priv->dev, name);if (IS_ERR (cell))return PTR_ERR (cell); buf =nvmem_cell_read (cell,NULL ); +nvmem_cell_put (cell);if (IS_ERR (buf))return PTR_ERR (buf);
Looks good to me.
This function is called multiple times and creates a cell each time, so it's probably better to delete it after using it.
Thank you,
---
Best Regards
Kunihiko Hayashi
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 4 lines · Rosen Penev
There is absolutely no reason to extend the lifetime of
nvmem_cell_getto after removal of the driver. Use and free right after use.Signed-off-by Rosen Penev <[email protected]>
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Quoted 2 lines
There is absolutely no reason to extend the lifetime of
nvmem_cell_getto after removal of the driver. Use and free right after use.
How do you think about to increase the application of scope-based resource management?
Regards,
Markus
Quoted 5 lines · Markus Elfring
Quoted 3 lines
There is absolutely no reason to extend the lifetime of
nvmem_cell_getto after removal of the driver. Use and free right after use.How do you think about to increase the application of scope-based resource management?
I don't really like it.
Quoted 3 lines
Regards,
Markus
Quoted 4 lines · Rosen Penev
There is absolutely no reason to extend the lifetime of
nvmem_cell_getto after removal of the driver. Use and free right after use.
Applied, thanks!
[1/1] phy: uniphier-usb3: no devm for nvmem_cell_get
commit: b2d5ad12d78a1070553f4cb6bf3315105a3b3da3
Best regards,
Signature · 1 line
~Vinod