AW: [PATCH] soc: aspeed: fix a ternary sign expansion bug

Sergey Organov sorganov at
Sat Apr 24 00:40:19 AEST 2021

Walter Harms <wharms at> writes:

> as indepentent observer,
> i would go for Dans solution:
> ret = kfifo_to_user();
> /* if an error occurs just return */
> if (ret)
>    return ret;
> /* otherwise return the copied number of bytes */
> return copied;
> there is no need for any deeper language knowledge,

Yep, but this is not idiomatic C, so one looking at this code would
tend to convert it back to ternary, and the actual problem here is that
the type of 'copied' does not match the return type of the function.

-- Sergey Organov

More information about the Linux-aspeed mailing list