Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: platform: samsung: s5p-jpeg: replace ternary operator with max()

Fix the following coccicheck warning:

drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c:1712:24-25:
WARNING opportunity for max()

max() macro is defined in include/linux/minmax.h. It avoids multiple
evaluations of the arguments when non-constant and performs strict
type-checking.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Guo Zhengkui and committed by
Mauro Carvalho Chehab
5fe1d61a db9edaaf

+1 -1
+1 -1
drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
··· 1709 1709 w_ratio = ctx->out_q.w / r->width; 1710 1710 h_ratio = ctx->out_q.h / r->height; 1711 1711 1712 - scale_factor = w_ratio > h_ratio ? w_ratio : h_ratio; 1712 + scale_factor = max(w_ratio, h_ratio); 1713 1713 scale_factor = clamp_val(scale_factor, 1, 8); 1714 1714 1715 1715 /* Align scale ratio to the nearest power of 2 */