From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5334547850789772318==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Fri, 22 Apr 2022 07:40:42 +0800 Message-ID: In-Reply-To: <202204220716.YVD1Mvku-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5334547850789772318== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: David Howells CC: Jakub Kicinski CC: linux-afs(a)lists.infradead.org CC: netdev(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot net/rxrpc/input.c:870:38-39: WARNING opportunity for min() Check for opencoded min(), max() implementations. Generated patches sometimes require adding a cast to fix compile warning. Warnings/patches scope intentionally limited to a function body. Generated by: scripts/coccinelle/misc/minmax.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 59f0c2447e2553b0918b4a9fd38763a5c0587d02 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 4 hours ago :::::: commit date: 12 months ago Please take the patch only if it's a positive warning. Thanks! net/rxrpc/input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c @@ -867,8 +867,7 @@ static void rxrpc_input_ack(struct rxrpc prev_pkt =3D ntohl(buf.ack.previousPacket); hard_ack =3D first_soft_ack - 1; nr_acks =3D buf.ack.nAcks; - summary.ack_reason =3D (buf.ack.reason < RXRPC_ACK__INVALID ? - buf.ack.reason : RXRPC_ACK__INVALID); + summary.ack_reason =3D min(buf.ack.reason, RXRPC_ACK__INVALID); = trace_rxrpc_rx_ack(call, ack_serial, acked_serial, first_soft_ack, prev_pkt, --===============5334547850789772318==--