Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3023704pxb; Fri, 8 Oct 2021 23:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7Goy4gJK22s2ddBpNDCn1ByYajzPc+oVdMMRlnewzC7ouGt/KBBcTZ7xNesvkD1ru5jqB X-Received: by 2002:a62:6243:0:b0:44b:e10e:61b0 with SMTP id w64-20020a626243000000b0044be10e61b0mr14130357pfb.53.1633759326605; Fri, 08 Oct 2021 23:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633759326; cv=none; d=google.com; s=arc-20160816; b=fYCP0TxAZ1bRl0Tnnou8x0pTPFc4bQIVEylcGCQ1+QjnziUTbH2z/sWHUfT1ChPJ44 dIKEI4NOVVLoUQzDsvdbeqW95Y6z8kHAiBvB+0CA9K/hKuxDmtWGdohDdinwrXisE89v ToR9Hyz6bhxA9h9HnzxzavypLH5+I2aNBD0qmZbmcdtAkDvu0SratFm4GfSHUay1QA6C z3/BfdL/JJcA4AnApN4PPDJf+nTlKPIrnKSpSJ1WyzLq8nto2VpGRJmzmbZyGT9lk8B7 XnSAhZ52fGdqq6yl/RBYjcZ7yUU+2rA2vWsBXWCQBNClrQgESDiO8XlCZituKFPvsw7f ksVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=C9X3+JbpAnm1664JqZK4rRwcWBLzpjufr2U1bouWSmk=; b=B/APyJwTRVuac+K4/LAH/1ITyiGB64ri5ceRuyj96qbo2rkBafeBLe+Vork9CYh6un ivu5h+7AsDx4zBQYTPLn80o5wKRtXpdSODGOU5kCDOgvge9Sz5nzK7Bg7L8/qxFDWYdi gC0mFECPBaO8FWPC3H7rve8MuAxBWa9KELa/ZDKddr/+hea9+4omrXu8t4og2eDjaJUB EmYqCcHjE+NqPBH0TbpNHxJXprW4mnMbn1D0TZ6D5pW3ZjnJU1U+dunOB/FHr1zPe/O1 JzEpoOMnzQN6cPkJruUcCUm7IztCps4bUPSQ2zjq+/nSiHZpC8bH9XAFmMEO+DA7gpRT yASg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FTTAtN3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si1946697pla.181.2021.10.08.23.01.48; Fri, 08 Oct 2021 23:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FTTAtN3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243850AbhJIGC5 (ORCPT + 99 others); Sat, 9 Oct 2021 02:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbhJIGC5 (ORCPT ); Sat, 9 Oct 2021 02:02:57 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF47BC061570 for ; Fri, 8 Oct 2021 23:01:00 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id y7so394439pfg.8 for ; Fri, 08 Oct 2021 23:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=C9X3+JbpAnm1664JqZK4rRwcWBLzpjufr2U1bouWSmk=; b=FTTAtN3DeEC4upmCz/vszJPmcjicDqXFKELIJgrzO7JVhy5N45E69h2lQm199jlEDU KrBZY3jLaEi2EzWTHOg/BKGvlbq4L5u0UNRrlYDFG0ja4dkObshzQG/nNQLWg755hIMx QxWg1OruTArVOLMLHMCbYc15jiabuEZXxyzmpLF90/EoGlypomvimx5Kxkow57bxslWJ o2InJdlHmGU9zPcyfd4mbpZmK8a6pHzF/OxXBzBWYyC01EDpPLXmF1gjXvxQFypOyheb 0oIClNY9E+Ng4UzpfGxCw0i4bjPlzlKaDFv/FCYCHvpyxf1t7Dc3yE2+RK54Dqoj4nmd DmCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=C9X3+JbpAnm1664JqZK4rRwcWBLzpjufr2U1bouWSmk=; b=e9mg424KPKeASsh8oZ1VQwz9yjTZPSNMtkNyv5Q8bVwiANYeF5P+owo5sVPxYaTvFV VXHw9Sp730SUDox1spta//YydWG456OlkRS7rhrwb2/AETbywfCp2kGK4kI3q1GxmAkE /+H28NzojDBrvHoxYGPaS6P91R+FqtaD8cNPKDNBQbVafX12lQ3c94J47QUGWcdEvtbm LCNWZQQZHXVt1ydCa3ycvXYZXQRWGaAoXvUEOzMAOkX1pLk4CKVVRgkUe5A3pa6VKIbs EvpOQNMTV6PWwDs6SvuUHUTbeTSABjlJUfPthWFUvr7bcF8BJMudwSuZdknexh2ZXB84 Pv7w== X-Gm-Message-State: AOAM533TFqsVmNLinZBlRmUUSlYtIyp3lSRPzCzbEbLlklN677mQqYMR cyDON9PIgaVQIM3mBeLIuZE= X-Received: by 2002:a63:e00b:: with SMTP id e11mr8261555pgh.190.1633759260137; Fri, 08 Oct 2021 23:01:00 -0700 (PDT) Received: from user ([223.230.43.197]) by smtp.gmail.com with ESMTPSA id s14sm1011264pfg.50.2021.10.08.23.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 23:00:59 -0700 (PDT) Date: Sat, 9 Oct 2021 11:30:53 +0530 From: Saurav Girepunje To: gregkh@linuxfoundation.org, fabioaiuto83@gmail.com, ross.schm.dev@gmail.com, deborahbrouwer3563@gmail.com, hdegoede@redhat.com, marcocesati@gmail.com, saurav.girepunje@gmail.com, phil@philpotter.co.uk, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: saurav.girepunje@hotmail.com Subject: [PATCH] staging: rtl8723bs: core: simplify the if condition Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org if psta is NULL, function is returning with fail. On next if condition again checking if psta is not a NULL. Remove multiple if condition check. Function is already using goto exit statement to exit.Replace multiple return with goto exit statement. Signed-off-by: Saurav Girepunje --- drivers/staging/rtl8723bs/core/rtw_xmit.c | 61 ++++++++++------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 34505b35a7f3..4e4a1bed882b 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -932,49 +932,40 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr /* TODO: fill HT Control Field */ /* Update Seq Num will be handled by f/w */ - { - struct sta_info *psta; - - psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); - if (pattrib->psta != psta) - return _FAIL; - - if (!psta) - return _FAIL; + struct sta_info *psta; - if (!(psta->state & _FW_LINKED)) - return _FAIL; + psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra); + if (!psta || pattrib->psta != psta || !(psta->state & _FW_LINKED)) + res = _FAIL; + goto exit; - if (psta) { - psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; - psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; - pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; + psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; + psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; + pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; - SetSeqNum(hdr, pattrib->seqnum); + SetSeqNum(hdr, pattrib->seqnum); - /* check if enable ampdu */ - if (pattrib->ht_en && psta->htpriv.ampdu_enable) - if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) - pattrib->ampdu_en = true; + /* check if enable ampdu */ + if (pattrib->ht_en && psta->htpriv.ampdu_enable) + if (psta->htpriv.agg_enable_bitmap & BIT(pattrib->priority)) + pattrib->ampdu_en = true; - /* re-check if enable ampdu by BA_starting_seqctrl */ - if (pattrib->ampdu_en == true) { - u16 tx_seq; + /* re-check if enable ampdu by BA_starting_seqctrl */ + if (pattrib->ampdu_en == true) { + u16 tx_seq; - tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f]; + tx_seq = psta->BA_starting_seqctrl[pattrib->priority & 0x0f]; - /* check BA_starting_seqctrl */ - if (SN_LESS(pattrib->seqnum, tx_seq)) { - pattrib->ampdu_en = false;/* AGG BK */ - } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { - psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff; + /* check BA_starting_seqctrl */ + if (SN_LESS(pattrib->seqnum, tx_seq)) { + pattrib->ampdu_en = false;/* AGG BK */ + } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff; - pattrib->ampdu_en = true;/* AGG EN */ - } else { - psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum+1)&0xfff; - pattrib->ampdu_en = true;/* AGG EN */ - } - } + pattrib->ampdu_en = true;/* AGG EN */ + } else { + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum+1)&0xfff; + pattrib->ampdu_en = true;/* AGG EN */ } } } -- 2.32.0