Skip to content

Commit

Permalink
PCI: keembay: Remove cast between incompatible function type
Browse files Browse the repository at this point in the history
Rather than casting void(*)(struct clk *) to void (*)(void *), that
forces conversion to an incompatible function type, replace the cast
with a small local stub function with a signature that matches what
the devm_add_action_or_reset() function expects.

The sub function takes a void *, then passes it directly to
clk_disable_unprepare(), which handles the more specific type.

Reported by clang when building with warnings enabled:

  drivers/pci/controller/dwc/pcie-keembay.c:172:12: warning: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
                                         (void(*)(void *))clk_disable_unprepare,
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No functional changes are intended.

Fixes: 0c87f90 ("PCI: keembay: Add support for Intel Keem Bay")
Link: https://lore.kernel.org/linux-pci/[email protected]
Acked-by: Srikanth Thokala <[email protected]>
Signed-off-by: Krzysztof Wilczyński <[email protected]>
  • Loading branch information
kwilczynski committed Jul 13, 2023
1 parent 1a8bf35 commit 7a65316
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/pci/controller/dwc/pcie-keembay.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ static const struct dw_pcie_ops keembay_pcie_ops = {
.stop_link = keembay_pcie_stop_link,
};

static inline void keembay_pcie_disable_clock(void *data)
{
struct clk *clk = data;

clk_disable_unprepare(clk);
}

static inline struct clk *keembay_pcie_probe_clock(struct device *dev,
const char *id, u64 rate)
{
Expand All @@ -168,9 +175,7 @@ static inline struct clk *keembay_pcie_probe_clock(struct device *dev,
if (ret)
return ERR_PTR(ret);

ret = devm_add_action_or_reset(dev,
(void(*)(void *))clk_disable_unprepare,
clk);
ret = devm_add_action_or_reset(dev, keembay_pcie_disable_clock, clk);
if (ret)
return ERR_PTR(ret);

Expand Down

0 comments on commit 7a65316

Please sign in to comment.