From patchwork Tue Oct 27 13:50:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4BF0C5DF9E for ; Tue, 27 Oct 2020 15:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5275A223FB for ; Tue, 27 Oct 2020 15:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813402; bh=b/C4lllXJjGS1GFK3sZBG0HqndHL2ZzbzHRAvd5JtJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lvmFxZeA59UNK2sfvlNOX1gxLVj9mYaz8nfrrWqCCBYWS0Lj6ZtKhFADAs+eS4+0N oZkYk9NK8m8Cbd1Nyb7hTIRqXtIHoBEiFMHlJL24zwQ2O9JwFwcCa/aeI9rOxH+QaS k1S0cQ2OLWusTjNUcSkD6dcY9P8ydbnuB3RpRkLg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1800006AbgJ0Peg (ORCPT ); Tue, 27 Oct 2020 11:34:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1800000AbgJ0Pef (ORCPT ); Tue, 27 Oct 2020 11:34:35 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D25FC22275; Tue, 27 Oct 2020 15:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812874; bh=b/C4lllXJjGS1GFK3sZBG0HqndHL2ZzbzHRAvd5JtJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3JI2IbEx05WHY16emV507EwkjAtuwBAFw5G/JS6YVrPlSzRjIyNRyEwWKsvmvwnd HIKXmDIP3TN7Yn/rLoU8jxigdTipBOIIJ6kVV0mNJUZwGyP9CtPuTmz8GFjc146oub 3NK0EganbrqRb1ML7buDD1vFwJc6FX85l+Ymnp1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.9 360/757] staging: rtl8712: Fix enqueue_reorder_recvframe() Date: Tue, 27 Oct 2020 14:50:10 +0100 Message-Id: <20201027135507.460350820@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter [ Upstream commit 29838144f280fc03ca06a621568f34e1d0a65a4f ] The logic of this function was accidentally broken by a checkpatch inspired cleanup. I've modified the code to restore the original behavior and also make checkpatch happy. Fixes: 98fe05e21a6e ("staging: rtl8712: Remove unnecesary else after return statement.") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20200929103548.GA493135@mwanda Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8712/rtl8712_recv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index d83f421acfc1e..a397dc6231f13 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -477,11 +477,14 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, while (!end_of_queue_search(phead, plist)) { pnextrframe = container_of(plist, union recv_frame, u.list); pnextattrib = &pnextrframe->u.hdr.attrib; + + if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) + return false; + if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) plist = plist->next; - else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num)) - return false; - break; + else + break; } list_del_init(&(prframe->u.hdr.list)); list_add_tail(&(prframe->u.hdr.list), plist);