Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp298248pxj; Wed, 16 Jun 2021 02:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMTAAHc3BbVUvrgeLadpwaXQyfq0A5vES3bxZrK6JjwwUAsLDGrgTrbEASUqMxE2azcW6x X-Received: by 2002:a05:6638:5b8:: with SMTP id b24mr3368216jar.37.1623836346848; Wed, 16 Jun 2021 02:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623836346; cv=none; d=google.com; s=arc-20160816; b=R6Kt8c/Ave2ODmPo2ZtrSjugmFlPh3nIJDRnln+voQ7fZYf6/olEzZ/lN7k9uAyNUX lYtt0MwCm/mzG+xZSiw+so2UL5r3xCyLaP91+qTOUcKzIDs+6WNu98/6M3ILMCjl5yD8 +dDoq5RETxiORFtGelG44Jsl7XhDIU3GuCcgkad3RlbAxVCPE+xI2ebxw9TW7Si+qe5Q V3BdzuNVzqf/VRAKZUIXx3/B8/Q4HET9yCuzCo4+0Ctx1klJGJndpvMiEjNAmbksaBDp 7frpPTk8ZjG9fxmcHXawTb1GWjPVD4dy9s8Hd7BDq37Aw8eJJJyU7ljzdPlqxIcalmLb HIUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=4hDWnKZN3CmRHGXRFWkCNvfVO0mfaONdodyzJlKkhiI=; b=KHCsrjUh4xUp2rayLYfSEeh8do5IjzapU84oVjDIuuRWA+aqlQJKBIXw061ybJZrNB T5+uoLmF2NJI1jmlj0ZsyZCe6QkE93do/gkchzdLW0OP+uZB/qT1iBdBf/WTW5ZuPpLR 7tCcAXVZx4LFneXtfes2lYunLvYXBeUY8veZ9kZtjLhPeVikIvixYkMtfIHvZEph22xl /wl8FZ/MQ4srlGsx+gQFy9zqLzONh/cEI8oRr3Rg8h5vjZN2GRbs5kiS+LN2NOVqvrcP I3bGWC1LylHdI3sn3pCFUh/0KQIkFiqL0iqE980y8EP8njKNKmzFrqbe4zJAAQ0YQt7S iBIQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si1885141ils.9.2021.06.16.02.38.55; Wed, 16 Jun 2021 02:39: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232453AbhFPJjd (ORCPT + 99 others); Wed, 16 Jun 2021 05:39:33 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:10100 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbhFPJjR (ORCPT ); Wed, 16 Jun 2021 05:39:17 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G4g4Q5PYZzZdxM; Wed, 16 Jun 2021 17:34:14 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 16 Jun 2021 17:37:10 +0800 Received: from localhost.localdomain (10.67.165.24) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 16 Jun 2021 17:37:09 +0800 From: Guangbin Huang To: , , , , CC: , , , Subject: [PATCH net-next 4/8] net: hdlc_ppp: move out assignment in if condition Date: Wed, 16 Jun 2021 17:33:53 +0800 Message-ID: <1623836037-26812-5-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1623836037-26812-1-git-send-email-huangguangbin2@huawei.com> References: <1623836037-26812-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggemi759-chm.china.huawei.com (10.1.198.145) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li Should not use assignment in if condition. Signed-off-by: Peng Li Signed-off-by: Guangbin Huang --- drivers/net/wan/hdlc_ppp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 8614912..fb5102c 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c @@ -375,7 +375,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id, u8 *out; unsigned int len = req_len, nak_len = 0, rej_len = 0; - if (!(out = kmalloc(len, GFP_ATOMIC))) { + out = kmalloc(len, GFP_ATOMIC); + if (!out) { dev->stats.rx_dropped++; return; /* out of memory, ignore CR packet */ } -- 2.8.1