Skip to content

Commit 7e58add

Browse files
nathanchancegregkh
authored andcommitted
HID: intel-ish-hid: Fix -Wcast-function-type-strict in devm_ishtp_alloc_workqueue()
commit 3644f44 upstream. Clang warns (or errors with CONFIG_WERROR=y / W=e): drivers/hid/intel-ish-hid/ipc/ipc.c:935:36: error: cast from 'void (*)(struct workqueue_struct *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 935 | if (devm_add_action_or_reset(dev, (void (*)(void *))destroy_workqueue, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/device/devres.h:168:34: note: expanded from macro 'devm_add_action_or_reset' 168 | __devm_add_action_or_ireset(dev, action, data, #action) | ^~~~~~ This warning is pointing out a kernel control flow integrity (kCFI / CONFIG_CFI=y) violation will occur due to this function cast when the destroy_workqueue() is indirectly called via devm_action_release() because the prototype of destroy_workqueue() does not match the prototype of (*action)(). Use a local function with the correct prototype to wrap destroy_workqueue() to resolve the warning and CFI violation. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202510190103.qTZvfdjj-lkp@intel.com/ Closes: ClangBuiltLinux#2139 Fixes: 0d30dae ("HID: intel-ish-hid: Use dedicated unbound workqueues to prevent resume blocking") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Zhang Lixu <lixu.zhang@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3d72fad commit 7e58add

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • drivers/hid/intel-ish-hid/ipc

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,11 @@ static const struct ishtp_hw_ops ish_hw_ops = {
933933
.dma_no_cache_snooping = _dma_no_cache_snooping
934934
};
935935

936+
static void ishtp_free_workqueue(void *wq)
937+
{
938+
destroy_workqueue(wq);
939+
}
940+
936941
static struct workqueue_struct *devm_ishtp_alloc_workqueue(struct device *dev)
937942
{
938943
struct workqueue_struct *wq;
@@ -941,8 +946,7 @@ static struct workqueue_struct *devm_ishtp_alloc_workqueue(struct device *dev)
941946
if (!wq)
942947
return NULL;
943948

944-
if (devm_add_action_or_reset(dev, (void (*)(void *))destroy_workqueue,
945-
wq))
949+
if (devm_add_action_or_reset(dev, ishtp_free_workqueue, wq))
946950
return NULL;
947951

948952
return wq;

0 commit comments

Comments
 (0)