From patchwork Thu Jun 24 01:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12340661 X-Patchwork-Delegate: kuba@kernel.org 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 412E6C49EA5 for ; Thu, 24 Jun 2021 01:18:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 284436137D for ; Thu, 24 Jun 2021 01:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbhFXBUa (ORCPT ); Wed, 23 Jun 2021 21:20:30 -0400 Received: from mx20.baidu.com ([111.202.115.85]:48686 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229864AbhFXBUa (ORCPT ); Wed, 23 Jun 2021 21:20:30 -0400 Received: from BC-Mail-Ex12.internal.baidu.com (unknown [172.31.51.52]) by Forcepoint Email with ESMTPS id BFC658B1C1A00E2B8333; Thu, 24 Jun 2021 09:18:04 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex12.internal.baidu.com (172.31.51.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.10; Thu, 24 Jun 2021 09:18:04 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Thu, 24 Jun 2021 09:18:04 +0800 From: Cai Huoqing To: , , , CC: , , , , Cai Huoqing Subject: [PATCH v2] virtio_net/vringh: add "else { }" according coding style Date: Thu, 24 Jun 2021 09:17:57 +0800 Message-ID: <20210624011757.338-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex11.internal.baidu.com (172.31.51.51) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org coding-style.rst shows that: if (condition) { do_this(); do_that(); } else { otherwise(); } Signed-off-by: Cai Huoqing --- drivers/net/virtio_net.c | 3 ++- drivers/vhost/vringh.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 21ff7b9e49c2..7cd062cb468e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -314,8 +314,9 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) rq->pages = (struct page *)p->private; /* clear private here, it is used to chain pages */ p->private = 0; - } else + } else { p = alloc_page(gfp_mask); + } return p; } diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 4af8fa259d65..79542cad1072 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -454,8 +454,9 @@ static inline int __vringh_complete(struct vringh *vrh, if (!err) err = putused(vrh, &used_ring->ring[0], used + part, num_used - part); - } else + } else { err = putused(vrh, &used_ring->ring[off], used, num_used); + } if (err) { vringh_bad("Failed to write %u used entries %u at %p",