From: Simon Horman Date: Wed, 10 May 2023 12:39:00 +0000 (+0200) Subject: mmc: meson-mx-sdhc: Avoid cast to incompatible function type X-Git-Tag: v6.6.17~4560^2~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6151bc77daac5ac89634ee49416ac562bfdee2ce;p=platform%2Fkernel%2Flinux-rpi.git 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 Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20230510-mmc-sdhci-msm-function-cast-v1-1-5ae634b24fbd@kernel.org Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c index da85c2f..97168cd 100644 --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c @@ -776,6 +776,11 @@ static void meson_mx_sdhc_init_hw(struct mmc_host *mmc) regmap_write(host->regmap, MESON_SDHC_ISTA, MESON_SDHC_ISTA_ALL_IRQS); } +static void meason_mx_mmc_free_host(void *data) +{ + mmc_free_host(data); +} + static int meson_mx_sdhc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -788,8 +793,7 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev) if (!mmc) return -ENOMEM; - ret = devm_add_action_or_reset(dev, (void(*)(void *))mmc_free_host, - mmc); + ret = devm_add_action_or_reset(dev, meason_mx_mmc_free_host, mmc); if (ret) { dev_err(dev, "Failed to register mmc_free_host action\n"); return ret;