linux/drivers/soc/aspeed
Dan Carpenter 5ffa828534 soc: aspeed: fix a ternary sign expansion bug
The intent here was to return negative error codes but it actually
returns positive values.  The problem is that type promotion with
ternary operations is quite complicated.

"ret" is an int.  "copied" is a u32.  And the snoop_file_read() function
returns long.  What happens is that "ret" is cast to u32 and becomes
positive then it's cast to long and it's still positive.

Fix this by removing the ternary so that "ret" is type promoted directly
to long.

Fixes: 3772e5da44 ("drivers/misc: Aspeed LPC snoop output using misc chardev")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Patrick Venture <venture@google.com>
Link: https://lore.kernel.org/r/YIE90PSXsMTa2Y8n@mwanda
Link: https://lore.kernel.org/r/20210423000919.1249474-1-joel@jms.id.au'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-04-23 11:16:47 +02:00
..
aspeed-lpc-ctrl.c soc: aspeed: Adapt to new LPC device tree layout 2021-04-09 13:39:22 +09:30
aspeed-lpc-snoop.c soc: aspeed: fix a ternary sign expansion bug 2021-04-23 11:16:47 +02:00
aspeed-p2a-ctrl.c
aspeed-socinfo.c soc: aspeed: socinfo: Add new systems 2021-02-10 22:25:45 +10:30
Kconfig soc: aspeed: Enable drivers with ARCH_ASPEED 2020-11-19 23:01:36 +10:30
Makefile soc: aspeed: Add soc info driver 2020-09-25 10:14:06 +09:30