Skip to content

Commit

Permalink
net: stmmac: dwmac-meson8b: Avoid cast to incompatible function type
Browse files Browse the repository at this point in the history
Rather than casting clk_disable_unprepare to an incompatible function
type provide a trivial wrapper with the correct signature for the
use-case.

Reported by clang-16 with W=1:

 drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c:276:6: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
                                        (void(*)(void *))clk_disable_unprepare,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No functional change intended.
Compile tested only.

Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Link: https://lore.kernel.org/r/20230418-dwmac-meson8b-clk-cb-cast-v1-1-e892b670cbbb@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Simon Horman authored and Jakub Kicinski committed Apr 20, 2023
1 parent 91daa4f commit 43bb610
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac)
return 0;
}

static void meson8b_clk_disable_unprepare(void *data)
{
clk_disable_unprepare(data);
}

static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac,
struct clk *clk)
{
Expand All @@ -273,8 +278,7 @@ static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac,
return ret;

return devm_add_action_or_reset(dwmac->dev,
(void(*)(void *))clk_disable_unprepare,
clk);
meson8b_clk_disable_unprepare, clk);
}

static int meson8b_init_rgmii_delays(struct meson8b_dwmac *dwmac)
Expand Down

0 comments on commit 43bb610

Please sign in to comment.