From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750988AbdCNJIx (ORCPT ); Tue, 14 Mar 2017 05:08:53 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:20332 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbdCNJIv (ORCPT ); Tue, 14 Mar 2017 05:08:51 -0400 Date: Tue, 14 Mar 2017 12:08:16 +0300 From: Dan Carpenter To: Colin King Cc: Karen Xie , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: cxgb3i: remove redundant null check and kfree on skb Message-ID: <20170314090816.GH4136@mwanda> References: <20170313191408.20080-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170313191408.20080-1-colin.king@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 13, 2017 at 07:14:08PM +0000, Colin King wrote: > From: Colin Ian King > > On the error exit path, skb is always null, so the non-null check > and __kfree_skb call are redundant. Remove the redundant code, > rename the rel_release label to err and make error paths jump to > the err exit path. > > Detected by CoverityScan, CID#114328 ("Logically Dead Code") > > Signed-off-by: Colin Ian King > --- > drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c > index 1880eb6..f453a78 100644 > --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c > +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c > @@ -972,21 +972,21 @@ static int init_act_open(struct cxgbi_sock *csk) > &csk->daddr.sin_addr.s_addr); > if (!csk->l2t) { > pr_err("NO l2t available.\n"); > - return -EINVAL; > + goto err; err is a bad name because it doesn't say what the goto does. Imagine if function names were so opaque. The most readable thing is a direct return. Also that's the least bug prone thing. regards, dan carpenter