From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3281835816723844899==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Mon, 14 Feb 2022 11:45:46 +0800 Message-ID: <20220214034546.GA46490@2ca604224c68> In-Reply-To: <202202141111.f3sebCI1-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3281835816723844899== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Mathias Nyman CC: "Greg Kroah-Hartman" CC: linux-usb(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/usb/host/xhci-mem.c:436:27-28: WARNING opportunity for max() 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: 754e0b0e35608ed5206d6a67a791563c631cec07 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 8 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! drivers/usb/host/xhci-mem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -433,8 +433,7 @@ int xhci_ring_expansion(struct xhci_hcd (TRBS_PER_SEGMENT - 1); = /* Allocate number of segments we needed, or double the ring size */ - num_segs =3D ring->num_segs > num_segs_needed ? - ring->num_segs : num_segs_needed; + num_segs =3D max(ring->num_segs, num_segs_needed); = ret =3D xhci_alloc_segments_for_ring(xhci, &first, &last, num_segs, ring->cycle_state, ring->type, --===============3281835816723844899==--