12.12.2021 09:50, Miaoqian Lin пишет:
The tegra_xusb_find_port_node() function may return error pointer when
kasprintf() return NULL. Using IS_ERR_OR_NULL to check the return value
of tegra_xusb_find_port_node() to catch this.
Signed-off-by: Miaoqian Lin <redacted>
---
drivers/phy/tegra/xusb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Instead of changing the 6 lines and making code less readable, you could
change a single line.
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 963de5913e50..aa5237eacd29 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -455,7 +455,7 @@ tegra_xusb_find_port_node(struct tegra_xusb_padctl
*padctl, const char *type,
name = kasprintf(GFP_KERNEL, "%s-%u", type, index);
if (!name) {
of_node_put(ports);
- return ERR_PTR(-ENOMEM);
+ return NULL;
}
np = of_get_child_by_name(ports, name);
kfree(name);
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy