linux/drivers/hid/intel-ish-hid
Nathan Chancellor 7e58addb8e HID: intel-ish-hid: Fix -Wcast-function-type-strict in devm_ishtp_alloc_workqueue()
commit 3644f44117 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: https://github.com/ClangBuiltLinux/linux/issues/2139
Fixes: 0d30dae38f ("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>
History 2026-01-23 11:21:36 +01:00
..
ipc HID: intel-ish-hid: Fix -Wcast-function-type-strict in devm_ishtp_alloc_workqueue() 2026-01-23 11:21:36 +01:00
ishtp HID: intel-ish-hid: Use dedicated unbound workqueues to prevent resume blocking 2026-01-23 11:21:36 +01:00
ishtp-fw-loader.c Merge branch 'for-6.13/core' into for-linus 2024-11-18 21:58:55 +01:00
ishtp-hid-client.c HID: intel-ish-hid: Use dedicated unbound workqueues to prevent resume blocking 2026-01-23 11:21:36 +01:00
ishtp-hid.c HID: intel-ish-hid: Fix use-after-free issue in ishtp_hid_remove() 2025-02-19 10:09:27 +01:00
ishtp-hid.h HID: ishtp-hid-client: replace fake-flex arrays with flex-array members 2024-10-08 08:52:27 +02:00
Kconfig HID: intel-thc: fix CONFIG_HID dependency 2025-02-03 10:56:43 +01:00
Makefile Kbuild updates for v6.10 2024-05-18 12:39:20 -07:00