mmc: meson-mx-sdhc: Avoid cast to incompatible function type
authorSimon Horman <horms@kernel.org>
Wed, 10 May 2023 12:39:00 +0000 (14:39 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 12 Jun 2023 13:16:18 +0000 (15:16 +0200)
commit6151bc77daac5ac89634ee49416ac562bfdee2ce
tree19f9f60c1f593f056f6ec16322e98a081a91a0d3
parent78ce88e7581f5737c9e4f6aa6df7abbd4835ad1c
mmc: meson-mx-sdhc: Avoid cast to incompatible function type

Rather than casting mmc_free_host to an incompatible function type,
provide a trivial wrapper with the correct signature for the use-case.

Reported by clang-16 with W=1:

 .../meson-mx-sdhc-mmc.c:791:38: error: cast from 'void (*)(struct mmc_host *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
         ret = devm_add_action_or_reset(dev, (void(*)(void *))mmc_free_host,
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./include/linux/device.h:265:38: note: expanded from macro 'devm_add_action_or_reset'
         __devm_add_action_or_reset(release, action, data, #action)
                                            ^~~~~~

The same approach is taken in litex_mmc.c with the function
litex_mmc_free_host_wrapper(). There may be scope for consolidation.

No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20230510-mmc-sdhci-msm-function-cast-v1-1-5ae634b24fbd@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/meson-mx-sdhc-mmc.c