Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp244232pxj; Wed, 23 Jun 2021 21:04:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+ztDrGaDFjLYYRa/dV2aoEnB1lPQgTTTku0LKeVzASmrRmTwiULZoglo5aH+x80hbKQz+ X-Received: by 2002:a92:b00b:: with SMTP id x11mr2167705ilh.130.1624507462899; Wed, 23 Jun 2021 21:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624507462; cv=none; d=google.com; s=arc-20160816; b=RjILORAwHgJTrFkNAItj90/W5gu/7TxtjdTivQiOGdNZ2L1V3UwQXgTQiqa3JXkC6i 2did5pLSC4MXootRvh8BQkLb+307cA7d2oEdqJxOxZFd8jidGVnUAy+72GXbyNWI/PXB l0vK/KdjLTot9XK5pj9Wfm1mCnx0QuQ0sQbjU2HZYjSbIr142XHKyrxSimqXAHHUEUtq T2jG/zvmvGhiGOPkNaNNwkZVr2L+il4nUkyz/y2eNJuO3Sl+EkQsh0CyCBDkukAR4dDI YJ8RnfCPRO/dspJArK5UEdH3QWCinSQ2xQ4eNkylv9NGfsrMJ2YZItwG7Bf5rTjc64jp ht4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=t6l8HNUseLWNe4QRrXc5Pxgwkec9RXr3zdcloJqebyc=; b=mY0Td0vZYCna3UcLaM8hCBS6PjL0q5r3MlLX90VqO0ailxrQjmIjNLuKrAjQ6DRsbg NdxF6PeBsZ2oXLdavS9dxF1bY0s3phkJGLZ39U589Tw5j9LrID6k7+hLDnlGGi1c1ulB il3gwf2ZAsp6Gsft+covxMi5hV8cxOQatG3wWRtqKzlecih18zq3R8u2kyIwu14+nizT ieIf+rFdISkrVykPMJwNvSc33QeKsDwb/pRJTR3ygCxshxEiyjmC0u9W9pslTgseEcv+ P5T1DAvPCNzcmQ9xOa+89Bn07+JIIIwrWs0wNY4LVdla9KDxuLEu7Tqe/S/ivv4B3VjA t7rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gLVhDbID; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i32si2236807jav.24.2021.06.23.21.04.10; Wed, 23 Jun 2021 21:04:22 -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=@redhat.com header.s=mimecast20190719 header.b=gLVhDbID; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbhFXEFw (ORCPT + 99 others); Thu, 24 Jun 2021 00:05:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21924 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbhFXEFp (ORCPT ); Thu, 24 Jun 2021 00:05:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624507381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t6l8HNUseLWNe4QRrXc5Pxgwkec9RXr3zdcloJqebyc=; b=gLVhDbID8o+MCAotB9oBrboA8Z3X58AE9zXVhWit2X/zYiiEi3AljxMpNralw70AJQxrbW Yi0xe2Y5z9qVkxjtJ60hyvbjovBnWFbegieiyLFet2Vbx/u2VskGXGPl1vN06pmOfSjxuy VN+gEMX0Ba9Gn0IxZ4EpWpfFG3HSQ6U= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-420-TYGsvB0SM26Vc-rd76Q17w-1; Thu, 24 Jun 2021 00:02:59 -0400 X-MC-Unique: TYGsvB0SM26Vc-rd76Q17w-1 Received: by mail-pj1-f70.google.com with SMTP id c5-20020a17090a1d05b029016f9eccfcd6so2580991pjd.0 for ; Wed, 23 Jun 2021 21:02:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=t6l8HNUseLWNe4QRrXc5Pxgwkec9RXr3zdcloJqebyc=; b=LdMqZxcM5g76x96r2DLaMrD30n/+sJgfNAXZ3HvKkQyoT6cqygSH8ZIHIjc0N8fvUm dCJqj611kkQzd1QtKkDOiMudX6HBvnjom/WauuKsk+RPiGlyCeHznl7naExzOFuC05Lt kHqvmbd7DYl9AE51mjSU3lqzzjya/7OklWN66WVmNgvTNxcgy57bmAcUy7u4CL/t03bx ogF458llXAURmRfLB/5snFisu+U0rUTPwnkTLQgE5X3LWB7+f8mxUEYVlFo9MDyl1xmA XaghYbwb9rRjM/6MIDA3wkqgKAFpul2AJYKXDgdnsd+xUjSSA1qL7f4ScACCbQa4UPq0 7q6w== X-Gm-Message-State: AOAM5305VIFJLBBHcxW5qNAVm/M5H1K9PlSG7vZWhTSSoSKyMjJxCKcB Zf0ij+rAnx4XDrC66rwRqEaSy6dXv+VneBBGD1RLTrzYTrfg8NT7AYKIwT8ch+VCcp0TxhrLzj3 mjGK+CRe7tywGRoeqflDdXpM7 X-Received: by 2002:a17:90a:bc89:: with SMTP id x9mr3143548pjr.228.1624507378319; Wed, 23 Jun 2021 21:02:58 -0700 (PDT) X-Received: by 2002:a17:90a:bc89:: with SMTP id x9mr3143534pjr.228.1624507378157; Wed, 23 Jun 2021 21:02:58 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id b6sm599868pgw.67.2021.06.23.21.02.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 21:02:57 -0700 (PDT) Subject: Re: [PATCH v2] virtio_net/vringh: add "else { }" according coding style To: Cai Huoqing , mst@redhat.com, davem@davemloft.net, kuba@kernel.org Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20210624011757.338-1-caihuoqing@baidu.com> From: Jason Wang Message-ID: <93b1bdd8-93b7-9e85-7c52-9b4b8ff36292@redhat.com> Date: Thu, 24 Jun 2021 12:02:49 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210624011757.338-1-caihuoqing@baidu.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2021/6/24 ????9:17, Cai Huoqing ะด??: > coding-style.rst shows that: > if (condition) { > do_this(); > do_that(); > } else { > otherwise(); > } So git grep told me there're at least 28 similar "issues" in drivers/virito. And there will be a lot in the other part of the kernel I think it's not worth to bother. We can start to work on something that is really interesting. E.g we had the plan to convert to use iov iterator instead of using a vringh specific iov "iterator" implementation. Do you want to do that? Thanks > > Signed-off-by: Cai Huoqing > --- > drivers/net/virtio_net.c | 3 ++- > drivers/vhost/vringh.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > 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", > -- > 2.17.1 >