Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp375958yba; Fri, 3 May 2019 03:38:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsF5Q5pjs50KJOoV0e8F3RKX8rKvmBmDiQZUoGBrs6JndorNd8jV9DQcwm3a5wgmo6Mqfk X-Received: by 2002:a17:902:f205:: with SMTP id gn5mr9276151plb.207.1556879888847; Fri, 03 May 2019 03:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556879888; cv=none; d=google.com; s=arc-20160816; b=nsZdKUEIFr0GQPq9ezYdtDvMffJsdcysGKwjlThDEuOgyX5XWVIuE8yc4jiATcd6Ar xC7Hi+DhntZv3tLGEWaLNAnF440SarYMcApTranFIiTQSiai12GN3QTdx5GXxO/nvYqD 7a62qZOwf45L9vaAQdf0ReUeW+4CxpxZ3+SEUfRJZ+sohGrebyCNQvhKnjY8UCabM8HS tPXe3gzfHEGAG+QJiQlzZ/IJqChjo3mcJTHzhZYjZu+fNgmryv8H6PdS6guL61PdyoAO +JiITB1PY1dT5k16eGJmu8gqS3w8FEvdKUVASb5v96KEfdKjo3LsKHquQM7EvGNMCI0v iXZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=XHnRFVe4JBgYNcBx6cWaxBO8r1B/OLArUOc6/V4j9ZU=; b=iN/Xz2qXcXJZxuWJ/AuqElKvf7NHeoGANkitPtNPBAf61LCSuYrBswyzqFt2xJgoln KepDX4gI6WNy9vIy4vdYChsV7xrCfttZE7WyxZ9yNx9l//FsLv+yxSXXqX5MKgYMgBui 2/oecMs0U6Ukabm0X/xpsnfQJtvx8oQmZm++nUpc6vXK8gQMI6H/7hlNrDylUeToyjr7 lN8st2ZvhdL8SSwN6wDd0v8xlDGHjInwV2Kc8ReYSzq3TOcJ0HmvQJtep8kRYBQTRTkA 00n8h6Foq76HZMkRHTpL/ULkuhlYDEBvVOSDzL0gsLE8hpp/jDjwG+4S/xURtAIgJ1t/ 4RBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si1726855pgu.75.2019.05.03.03.37.54; Fri, 03 May 2019 03:38:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727415AbfECKcU (ORCPT + 99 others); Fri, 3 May 2019 06:32:20 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:48822 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbfECKcU (ORCPT ); Fri, 3 May 2019 06:32:20 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x43AWGMY012128, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x43AWGMY012128 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NOT); Fri, 3 May 2019 18:32:16 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.408.0; Fri, 3 May 2019 18:32:15 +0800 From: To: CC: Subject: [PATCH 5/6] rtw88: mac: remove dangerous while (1) Date: Fri, 3 May 2019 18:31:41 +0800 Message-ID: <1556879502-16211-6-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556879502-16211-1-git-send-email-yhchuang@realtek.com> References: <1556879502-16211-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Not to use while (1) to parse power sequence commands in an array. Put the statement (when cmd is not NULL) instead to make the loop stop when the next fetched command is NULL. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/mac.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c index 25a923b..7487b2e 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.c +++ b/drivers/net/wireless/realtek/rtw88/mac.c @@ -203,17 +203,14 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, return -EINVAL; } - do { - cmd = cmd_seq[idx]; - if (!cmd) - break; - + while ((cmd = cmd_seq[idx])) { ret = rtw_sub_pwr_seq_parser(rtwdev, intf_mask, cut_mask, cmd); if (ret) return -EBUSY; + /* fetch next command */ idx++; - } while (1); + }; return 0; } -- 2.7.4