From patchwork Wed May 17 22:06:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9731983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 09231601BC for ; Wed, 17 May 2017 22:28:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC4B287AB for ; Wed, 17 May 2017 22:28:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CA59287F2; Wed, 17 May 2017 22:28:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_NUMERIC_HELO autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1369D287AB for ; Wed, 17 May 2017 22:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212AbdEQW2l (ORCPT ); Wed, 17 May 2017 18:28:41 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.56]:37998 "EHLO gateway24.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754191AbdEQW2k (ORCPT ); Wed, 17 May 2017 18:28:40 -0400 X-Greylist: delayed 1302 seconds by postgrey-1.27 at vger.kernel.org; Wed, 17 May 2017 18:28:40 EDT Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 9AE502B2A for ; Wed, 17 May 2017 17:06:55 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id B75cd7f6uCWWRB75cdxynX; Wed, 17 May 2017 17:06:40 -0500 Received: from gator4166.hostgator.com ([108.167.133.22]:22792) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1dB75r-000W17-C8; Wed, 17 May 2017 17:06:55 -0500 Received: from 189.152.179.187 ([189.152.179.187]) by gator4166.hostgator.com (Horde Framework) with HTTPS; Wed, 17 May 2017 17:06:54 -0500 Date: Wed, 17 May 2017 17:06:54 -0500 Message-ID: <20170517170654.Horde.cfktFjC4G4wPJvJ8X1ZyUvW@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Faisal Latif , Shiraz Saleem , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [infiniband-hw-i40iw] question about identical code for different branches User-Agent: Horde Application Framework 5 MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Exim-ID: 1dB75r-000W17-C8 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:22792 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 2 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello everybody, While looking into Coverity ID 1362263 I ran into the following piece of code at drivers/infiniband/hw/i40iw/i40iw_virtchnl.c:445: 445 if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) { 446 if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0) 447 vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg); 448 else 449 vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg); 450 return I40IW_SUCCESS; 451 } The issue is that lines of code 447 and 449 are identical for different branches. My question here is if one of the branches should be modified, or the entire _if_ statement replaced? Maybe a patch like the following could be applied: index f4d1368..48fd327 100644 for (iw_vf_idx = 0; iw_vf_idx < I40IW_MAX_PE_ENABLED_VF_COUNT; iw_vf_idx++) { What do you think? I'd really appreciate any comment on this. Thank you! Reviewed-by: Yuval Shaia --- Gustavo A. R. Silva -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c +++ b/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c @@ -443,10 +443,7 @@ enum i40iw_status_code i40iw_vchnl_recv_pf(struct i40iw_sc_dev *dev, if (!dev->vchnl_up) return I40IW_ERR_NOT_READY; if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) { - if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0) - vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg); - else - vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg); + vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg); return I40IW_SUCCESS; }