Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp549487imm; Thu, 26 Jul 2018 08:03:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdsqo2pUOyphsH8ptKYbfR1AMXo1O4DBIwE0djaJAFPJ2vcHJmqhFPf5uCU0hbhUjX3+Vca X-Received: by 2002:a63:1015:: with SMTP id f21-v6mr2350463pgl.354.1532617403862; Thu, 26 Jul 2018 08:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532617403; cv=none; d=google.com; s=arc-20160816; b=Ty6XxG8gkdGdKTBIMio3adrbvZ6P5Q6/XIHzWgQMrkrZCfb//rlVKAOh2RKQP0VXGa EImNVyX2UoodFY0UuHM0kw76wQKCx8gXEIBD+fFSixopCwteND9Xp3TyDV0yu61PSCvn SYY+DGCZvN/VbV2ekUKTnO4lopLB4/nv2kA0y9F0bRq5+rAW+cS8UCQ3YosRwQnSb7Mk eUtAcGCDuv/cjdVjqr9wBUEDapdJoSs9Ek1MLb0jAC+CRZTmykSYF1RmG0fLCBaQ2vDU NHUm0Y1iF3Z+uhZxboL0rQZVt8XQtp63CPFjOGCQeyKY5XNW6eDHOUSm1iM7dByx9c8m /slQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=QGdFZAf+qgfLjp3esZUm5frcqOnzR19zF8vZ1a3gaYM=; b=ZM8Py1FDJ5RogrgC3kgjraBNIHsTiwnK/mdDSDIK9dU5JHMniYjwLU4awD4uRun5D6 lxgI3NaYNenRNAAwOSLVOq4asPYB2zEMYSBV3SyO5aUbzoo6KsIhOzFq4MHknOIJ45l0 VyKez/9hItkHegxRvDa8Heuz2686NhKGWDmpOL2b7xNds0lMRbiW3VFScvolK/fHANlI jsik8hB/XxftZG8Kw9YVg3TRNCN5z8agoOI/9oTLnnNfTDzttKocK7GLJGj0HFsTmCUv KY3krgR4E+Xw6O5hYI+Nb2ugITNAWeUz9HY5Z4Xxu/tRvIWSfqNuJtUAvnZ+4olCqJuy ze5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="cz/u2jnN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si1374297pfg.258.2018.07.26.08.02.54; Thu, 26 Jul 2018 08:03:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="cz/u2jnN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731586AbeGZQLt (ORCPT + 99 others); Thu, 26 Jul 2018 12:11:49 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33631 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730517AbeGZQLt (ORCPT ); Thu, 26 Jul 2018 12:11:49 -0400 Received: by mail-qt0-f195.google.com with SMTP id c15-v6so1828702qtp.0 for ; Thu, 26 Jul 2018 07:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QGdFZAf+qgfLjp3esZUm5frcqOnzR19zF8vZ1a3gaYM=; b=cz/u2jnN3ELHNIvZoFLcMUaJqOmAYz2BWGPq1RI1s5NlHhb3vo1XoHReKitDHZhQGB 8lS/PDaJH6A9FIdXQQleiZAQLXA5dbODUTqHG8wy5jW0nCkoGDv+psIOVHVXkFDtyLZq Xr0X5itKGq8NjQGqh/3/a6Y48M5ESll7U7gGM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QGdFZAf+qgfLjp3esZUm5frcqOnzR19zF8vZ1a3gaYM=; b=AImnO16h+Y8k6ocSTF64lP9DXjZSNFV670sIF8y6VQPM6qGNYVwulN6jUFBD5pX3M0 35u0nQZbdtYbdBIIyS+l3iNoMVbDOJJduibE8GZG3Kux5cHV+CZCrexEXOK625bLtECd d9DxjnPu5YyPkUvEisgeC4VaonTTEd0c2YljlR8TUwfTG+JAR08+/PdYbCWbYI2av1Xy RdTCBqmYa0NqyDoxqs6iSFPw+LPmvLxeTyjNSTE5c5Yzxwd1Uemhl+FxANTeDMZCeZcE aU2G/TPjNBmx8SqF+BYb35gP4QWRYDEVDszucceLHAPnpuOGpn33EYpT+3kn0aFQ7XTp wNRQ== X-Gm-Message-State: AOUpUlG9WXx1Wz1REwYcM9L+wKP6TBrIqdXQonhzJZ0mQv1WwNiNKFSx MvmBnBOIaH7DDlUgQiFjyxfiCYJo0uZEK6us8A9y9g== X-Received: by 2002:a0c:9dd0:: with SMTP id p16-v6mr1957816qvf.211.1532616874756; Thu, 26 Jul 2018 07:54:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9206:0:0:0:0:0 with HTTP; Thu, 26 Jul 2018 07:54:34 -0700 (PDT) In-Reply-To: <20180725111459.10800-1-yuehaibing@huawei.com> References: <20180725111459.10800-1-yuehaibing@huawei.com> From: Vasundhara Volam Date: Thu, 26 Jul 2018 20:24:34 +0530 Message-ID: Subject: Re: [PATCH net-next] bnxt_en: combine 'else if' and 'else' into single branche To: YueHaibing Cc: David Miller , "michael.chan@broadcom.com" , open list , Netdev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 25, 2018 at 4:44 PM, YueHaibing wrote: > > The else-if branch and else branch set mac_ok to true similarly, > so combine the two into single else branch. > > Aslo add comments to explain the two conditions, which > from Michael Chan and Vasundhara Volam. > > Signed-off-by: YueHaibing > --- > drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c > index a649108..f560845 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c > @@ -956,9 +956,13 @@ static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) > } else if (is_valid_ether_addr(vf->vf_mac_addr)) { > if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr)) > mac_ok = true; > - } else if (bp->hwrm_spec_code < 0x10202) { > - mac_ok = true; > } else { > + /* There are two cases: > + * 1.If firmware spec < 0x10202,VF MAC address is not forwarded > + * to the PF and so it doesn't have to match > + * 2.Allow VF to modify it's own MAC when PF has not assigned a > + * valid MAC address and firmware spec >= 0x10202 > + */ No, this is not correct either. You are not covering both conditions. else part with cover if (!is_valid_ether_addr(vf->vf_mac_addr)) before. > mac_ok = true; > } > if (mac_ok) > -- > 2.7.0 > >