diff mbox series

PCI: microchip: Avoid cast to incompatible function type

Message ID 20230511-pci-microchip-clk-cast-v1-1-7674f4d4e218@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series PCI: microchip: Avoid cast to incompatible function type | expand

Checks

Context Check Description
conchuod/cover_letter success Single patches do not need cover letters
conchuod/tree_selection success Guessed tree name to be for-next at HEAD ac9a78681b92
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 6 and now 6
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 15 this patch: 14
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 28 this patch: 28
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 3 this patch: 3
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Simon Horman May 11, 2023, 3:24 p.m. UTC
Rather than casting clk_disable_unprepare to an incompatible function type,
update the type to match that expected by devm_add_action_or_reset.

Reported by clang-16 with W-1:

 .../pcie-microchip-host.c:866:32: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
         devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./include/linux/device.h:265:38: note: expanded from macro 'devm_add_action_or_reset'
         __devm_add_action_or_reset(release, action, data, #action)
                                             ^~~~~~
No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/pci/controller/pcie-microchip-host.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Conor Dooley May 11, 2023, 3:30 p.m. UTC | #1
On Thu, May 11, 2023 at 05:24:18PM +0200, Simon Horman wrote:
> Rather than casting clk_disable_unprepare to an incompatible function type,
> update the type to match that expected by devm_add_action_or_reset.
> 
> Reported by clang-16 with W-1:
> 
>  .../pcie-microchip-host.c:866:32: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
>          devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
>                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  ./include/linux/device.h:265:38: note: expanded from macro 'devm_add_action_or_reset'
>          __devm_add_action_or_reset(release, action, data, #action)
>                                              ^~~~~~
> No functional change intended.
> Compile tested only.
> 

Yeah, there's already a patch for this:
https://lore.kernel.org/linux-pci/20230111125323.1911373-3-daire.mcnamara@microchip.com/

The lads didn't want to pick any of that piecemeal & Daire hasn't been
able to get back to that work until this week.

I don't think we an ETA though on a v4, so:
Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver")
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
and I don't know if you wanna propagate the:
| Reported-by: kernel test robot <lkp@intel.com>

Thanks,
Conor.

> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/pci/controller/pcie-microchip-host.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
> index 5e710e485464..d8aa6e3cdbff 100644
> --- a/drivers/pci/controller/pcie-microchip-host.c
> +++ b/drivers/pci/controller/pcie-microchip-host.c
> @@ -848,6 +848,11 @@ static const struct irq_domain_ops event_domain_ops = {
>  	.map = mc_pcie_event_map,
>  };
>  
> +inline void mc_clk_disable_unprepare(void *data)
> +{
> +	clk_disable_unprepare(data);
> +}
> +
>  static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
>  {
>  	struct clk *clk;
> @@ -863,8 +868,7 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> -	devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
> -				 clk);
> +	devm_add_action_or_reset(dev, mc_clk_disable_unprepare, clk);
>  
>  	return clk;
>  }
>
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index 5e710e485464..d8aa6e3cdbff 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -848,6 +848,11 @@  static const struct irq_domain_ops event_domain_ops = {
 	.map = mc_pcie_event_map,
 };
 
+inline void mc_clk_disable_unprepare(void *data)
+{
+	clk_disable_unprepare(data);
+}
+
 static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
 {
 	struct clk *clk;
@@ -863,8 +868,7 @@  static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
 	if (ret)
 		return ERR_PTR(ret);
 
-	devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
-				 clk);
+	devm_add_action_or_reset(dev, mc_clk_disable_unprepare, clk);
 
 	return clk;
 }