diff mbox series

clk: mediatek: reset: Return regmap's error code

Message ID 20240717115919.975474-1-fshao@chromium.org (mailing list archive)
State New, archived
Headers show
Series clk: mediatek: reset: Return regmap's error code | expand

Commit Message

Fei Shao July 17, 2024, 11:58 a.m. UTC
device_node_to_regmap() can return different errors, and it's better
practice to pass them to callers.

Clean up the hardcoded -EINVAL and use PTR_ERR(regmap) instead.

Signed-off-by: Fei Shao <fshao@chromium.org>
---

 drivers/clk/mediatek/reset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

AngeloGioacchino Del Regno July 17, 2024, 12:51 p.m. UTC | #1
Il 17/07/24 13:58, Fei Shao ha scritto:
> device_node_to_regmap() can return different errors, and it's better
> practice to pass them to callers.
> 
> Clean up the hardcoded -EINVAL and use PTR_ERR(regmap) instead.
> 
> Signed-off-by: Fei Shao <fshao@chromium.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Stephen Boyd July 29, 2024, 11:01 p.m. UTC | #2
Quoting Fei Shao (2024-07-17 04:58:52)
> device_node_to_regmap() can return different errors, and it's better
> practice to pass them to callers.
> 
> Clean up the hardcoded -EINVAL and use PTR_ERR(regmap) instead.
> 
> Signed-off-by: Fei Shao <fshao@chromium.org>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c
index 290ceda84ce4..f8c0fd031512 100644
--- a/drivers/clk/mediatek/reset.c
+++ b/drivers/clk/mediatek/reset.c
@@ -138,7 +138,7 @@  int mtk_register_reset_controller(struct device_node *np,
 	regmap = device_node_to_regmap(np);
 	if (IS_ERR(regmap)) {
 		pr_err("Cannot find regmap for %pOF: %pe\n", np, regmap);
-		return -EINVAL;
+		return PTR_ERR(regmap);
 	}
 
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
@@ -198,7 +198,7 @@  int mtk_register_reset_controller_with_dev(struct device *dev,
 	regmap = device_node_to_regmap(np);
 	if (IS_ERR(regmap)) {
 		dev_err(dev, "Cannot find regmap %pe\n", regmap);
-		return -EINVAL;
+		return PTR_ERR(regmap);
 	}
 
 	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);