Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp220204pxj; Wed, 16 Jun 2021 00:27:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPThGo4ioG5Iviom7w7AIe+vk/nWIv/UavVrWgX3Qmk7BQhTLkiwCUlObJxw8uEJtnbydr X-Received: by 2002:a05:6e02:4a5:: with SMTP id e5mr2649751ils.159.1623828475106; Wed, 16 Jun 2021 00:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623828475; cv=none; d=google.com; s=arc-20160816; b=JGO+U1Q7bzdzkqUiCkp+yYYpaKriTIFkslo1wMItlLVYND7CDPKGyv049mOEWwUzEQ 0CuhLbKC1uwjUz6NYMPkh9DoyMH/DZ4UmUoSJXCz2MhecF0+rJFR/U1C2p2JpdO6ofJJ MPCKWMMTruVeRyMDhC85fEURZmcNvTNFugLjQKK5jAqQjnVEiavk1fEY74H2En0GY6GJ 5UuW9xuOmWxKU0X4DeueqIi19BkwcyQAz7f7iFBkjlYWp+37c/sTciRB23e4uTB9lG8O 7FfXJLcJm0BWxF0N6WLJlpYaEF1UeY5Me6ccIvGsbYZD3CvcTKtdNp5afwr0GL3K8ZsZ NNMg== 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=KUulO+UCU7+8OfzzhcHF49GNwz/JNl2bS+PTrqtWQxE=; b=urMQREhpGVJdCwQbs9ZAREnpRg5xn9/sHjCAyqUnQcUwpM/uwaONsh8zYsZAIIXmWZ 0oVTaxsgDvODowwuZneHmBNvJL9k6b3SLSLRtITHXWmeEuAA1ul9ImESfwUvwyo2NcMB ULlUp6ve+pL6US+1ohLmi6wvcQKWIBW9aW8jAJzSAwdb6VWfPONtn9PMfZqOvFB0tiEV VZ1YhzprTOB6QGoeBvY/SZG/dVnHkvK19jpt2o/n42rYF7A9+lfY3mR9ZUkOxlE7rjVj QWPxxqYV7LfxPCByq7v7K3emJt7jUqWu6kIJQanlXEl12Uftlcvc0SD+YHyZvjoW5WwN vDMw== 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 15si1709296ilz.158.2021.06.16.00.27.43; Wed, 16 Jun 2021 00:27:55 -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 S232009AbhFPH3M (ORCPT + 99 others); Wed, 16 Jun 2021 03:29:12 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:7294 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbhFPH3A (ORCPT ); Wed, 16 Jun 2021 03:29:00 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4G4c7h4dDRz1BN7F; Wed, 16 Jun 2021 15:21:52 +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 15:26:53 +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 15:26:53 +0800 From: Guangbin Huang To: , , , , CC: , , , Subject: [PATCH net-next 04/15] net: cosa: replace comparison to NULL with "!chan->rx_skb" Date: Wed, 16 Jun 2021 15:23:30 +0800 Message-ID: <1623828221-48349-5-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1623828221-48349-1-git-send-email-huangguangbin2@huawei.com> References: <1623828221-48349-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 According to the chackpatch.pl, comparison to NULL could be written "!chan->rx_skb". Signed-off-by: Peng Li Signed-off-by: Guangbin Huang --- drivers/net/wan/cosa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index c051c61..7b57233 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -719,7 +719,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size) */ kfree_skb(chan->rx_skb); chan->rx_skb = dev_alloc_skb(size); - if (chan->rx_skb == NULL) { + if (!chan->rx_skb) { pr_notice("%s: Memory squeeze, dropping packet\n", chan->name); chan->netdev->stats.rx_dropped++; return NULL; @@ -783,7 +783,7 @@ static ssize_t cosa_read(struct file *file, return -ERESTARTSYS; chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL); - if (chan->rxdata == NULL) { + if (!chan->rxdata) { mutex_unlock(&chan->rlock); return -ENOMEM; } @@ -861,7 +861,7 @@ static ssize_t cosa_write(struct file *file, /* Allocate the buffer */ kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA); - if (kbuf == NULL) { + if (!kbuf) { up(&chan->wsem); return -ENOMEM; } -- 2.8.1