Skip to contentSkip to conversation

nvmem: meson-efuse: fix function pointer type mismatch

PATCH In review Arnd Bergmann 2 participants 2 messages Feb 13, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmem: meson-efuse: fix function pointer type mismatch

From: Arnd Bergmann <[email protected]>

clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:

drivers/nvmem/meson-efuse.c:78:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
78 | (void(*)(void *))clk_disable_unprepare,

Address this with a trivial helper function that adjusts the return code.

Fixes 611fbca1c861 ("nvmem: meson-efuse: add peripheral clock")
---
 drivers/nvmem/meson-efuse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/nvmem/meson-efuse.c +6 -3
index b922df99f9bc..3b9e31d7d073 100644
@@ -38,6 +38,11 @@ static const struct of_device_id meson_efuse_match[] = {
 };
 MODULE_DEVICE_TABLE(of, meson_efuse_match);
 
+static void meson_efuse_clk_disable(void *clk)
+{
+	clk_disable_unprepare(clk);
+}
+
 static int meson_efuse_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -74,9 +79,7 @@ static int meson_efuse_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = devm_add_action_or_reset(dev,
-				       (void(*)(void *))clk_disable_unprepare,
-				       clk);
+	ret = devm_add_action_or_reset(dev, meson_efuse_clk_disable, clk);
 	if (ret) {
 		dev_err(dev, "failed to add disable callback");
 		return ret;
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:

drivers/nvmem/meson-efuse.c:78:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
78 | (void(*)(void *))clk_disable_unprepare,

Address this with a trivial helper function that adjusts the return code.

Fixes 611fbca1c861 ("nvmem: meson-efuse: add peripheral clock")
---
  drivers/nvmem/meson-efuse.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/nvmem/meson-efuse.c +5 -0
index b922df99f9bc..3b9e31d7d073 100644
@@ -38,6 +38,11 @@ static const struct of_device_id meson_efuse_match[] = {
  };
  MODULE_DEVICE_TABLE(of, meson_efuse_match);
 
+static void meson_efuse_clk_disable(void *clk)
+{
+	clk_disable_unprepare(clk);
+}
+
  static int meson_efuse_probe(struct platform_device *pdev)
  {
  	struct device *dev = &pdev->dev;

drivers/nvmem/meson-efuse.c static int meson_efuse_probe(struct platform_device *pdev) · line 85

Quoted 10 lines
drivers/nvmem/meson-efuse.c +1 -3
@@ -74,9 +79,7 @@ static int meson_efuse_probe(struct platform_device *pdev)
  		return ret;
  	}
 
-	ret = devm_add_action_or_reset(dev,
-				       (void(*)(void *))clk_disable_unprepare,
-				       clk);
+	ret = devm_add_action_or_reset(dev, meson_efuse_clk_disable, clk);
  	if (ret) {
  		dev_err(dev, "failed to add disable callback");
  		return ret;