Skip to content

Commit a9a3343

Browse files
qasim-ijazjfvogel
authored andcommitted
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: df0383f ("usb: typec: ucsi: Add debugfs for ucsi commands") Cc: [email protected] Signed-off-by: Qasim Ijaz <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 4490c7951898dc64505533e7979837429bc9e290) Signed-off-by: Jack Vogel <[email protected]>
1 parent fb1d32f commit a9a3343

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/typec/ucsi/ucsi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ struct ucsi_debugfs_entry {
367367
u64 low;
368368
u64 high;
369369
} response;
370-
u32 status;
370+
int status;
371371
struct dentry *dentry;
372372
};
373373

0 commit comments

Comments
 (0)