aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQasim Ijaz <qasdev00@gmail.com>2025-04-22 14:47:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-10 07:17:10 -0400
commitf35a1e0b38d2724f338df2d3660927d8c4cd7a4e (patch)
tree1e79f1c9a47be38507a92d5cbf1041f19d797c0e
parentUSB: serial: pl2303: add new chip PL2303GC-Q20 and PL2303GT-2AB (diff)
downloadlaptop-kernel-f35a1e0b38d2724f338df2d3660927d8c4cd7a4e.tar.xz
laptop-kernel-f35a1e0b38d2724f338df2d3660927d8c4cd7a4e.zip
usb: typec: ucsi: fix Clang -Wsign-conversion warning
commit f4239ace2dd8606f6824757f192965a95746da05 upstream. debugfs.c emits the following warnings when compiling with the -Wsign-conversion flag with clang 15: drivers/usb/typec/ucsi/debugfs.c:58:27: warning: implicit conversion changes signedness: 'int' to 'u32' (aka 'unsigned int') [-Wsign-conversion] ucsi->debugfs->status = ret; ~ ^~~ drivers/usb/typec/ucsi/debugfs.c:71:25: warning: implicit conversion changes signedness: 'u32' (aka 'unsigned int') to 'int' [-Wsign-conversion] return ucsi->debugfs->status; ~~~~~~ ~~~~~~~~~~~~~~~^~~~~~ During ucsi_cmd() we see: if (ret < 0) { ucsi->debugfs->status = ret; return ret; } But "status" is u32 meaning unsigned wrap-around occurs when assigning a value which is < 0 to it, this obscures the real status. To fix this make the "status" of type int since ret is also of type int. Fixes: df0383ffad64 ("usb: typec: ucsi: Add debugfs for ucsi commands") Cc: stable@vger.kernel.org Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20250422134717.66218-1-qasdev00@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/ucsi/ucsi.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 9c5278a0c5d4..70910232a05d 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -434,7 +434,7 @@ struct ucsi_debugfs_entry {
u64 low;
u64 high;
} response;
- u32 status;
+ int status;
struct dentry *dentry;
};