usb: typec: tipd: declare in_data in as const in exec_cmd functions
authorJavier Carrasco <javier.carrasco@wolfvision.net>
Thu, 14 Dec 2023 16:29:11 +0000 (17:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Jan 2024 13:41:29 +0000 (14:41 +0100)
commite79ead88eeb8f3e945355b537bfaca7532dfee10
tree3041f81e32d4cb664020155c81a5f6240aec8802
parent798531b85f08c1dd128b88acd1f98c6a6b30dffd
usb: typec: tipd: declare in_data in as const in exec_cmd functions

The input data passed to execute commands with tps6598x_exec_cmd()
is not supposed to be modified by the function. Moreover, this data is
passed to tps6598x_exec_cmd_tmo() and finally to tps6598x_block_write(),
which expects a const pointer.

The current implementation does not produce any bugs, but it discards
const qualifiers from the pointers passed as arguments. This leads to
compile issues if 'discarded-qualifiers' is active and a const pointer
is passed to the function, which is the case if data from a firmware
structure is passed to execute update commands. Adding the const
modifier to in_data prevents such issues and provides code consistency.

Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20231207-tps6598x_update-v2-3-f3cfcde6d890@wolfvision.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tipd/core.c