Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp805621pxy; Fri, 30 Apr 2021 17:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsV8l8w7n+Bpb12umghKs3x/swtYb82YR8jTB06bAzRUoLzxUWwElgR/u87CNXE14XZvuF X-Received: by 2002:a05:6402:27d3:: with SMTP id c19mr9191575ede.129.1619829008403; Fri, 30 Apr 2021 17:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619829008; cv=none; d=google.com; s=arc-20160816; b=k+5Y8ryEAfU+v5ZNR3rs6eb/znIYYAlPbbIzPowiGjs4DpjHzz8IXgQktAyHCTuTG5 07WwvYiiOPPbdmwlH/EbcTCxEdO4+L53NyIwxNsBN05u9+o8rKtHTU8OYaHEDd5MAiYR 8J6IYuJux4fNsSeBhjcdKXaWxc04aaYg5olCH5zH3OGA1Co1vZ0zDs+fqGZYFghVX0Rx RPyyOXgz0lxfRIt8MXFlEwWxhOR0dw7kJQqFRxdpNgivb9LIjbhFa3FPp2lrzd6YPBsu 7A2FgiW6wnyQ0vgNEaOU0q0/Fa31iwQdc3+ZhKt2QJYaQAUUjvbBW033o0QrtiSdhkK/ g81A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=TDYLYYwfl3xcarv478NNm2FgJV3GKIB9RP6zcqAbHio=; b=Jb7rBN1ONiMFJEwXLo/XLJmfJ38hxxMkLo4jAiVcSk3NgipdSgb60EZmI8EDwYr899 bLKEXpYv10qbcYjkNPcjw/eDGVCfb6q9I0sM6xtfcQvOaJGUdYcaFryi3lWhJmzQXu2B qihXPFyOk09SRyxWTFEO3MWAezkSR0fKTlfUD/YZt9XRhoQVOrk9r+Y07O+hPFMD5pmZ KIukwlAd6cnXrRNFAxdDI8W+CDXgvhEiaJ0a6GYDWehM4NusNSfaFmEyyoCuxWHSHS8h lEe/G5NVRNQFbLAlT8oxvR3Ehd7mm/Mefephp8cV9pcebWVGY22weUpmRB49+fveuoCn h2Yw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u17si4625435ejz.120.2021.04.30.17.29.45; Fri, 30 Apr 2021 17:30:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231886AbhEAA16 (ORCPT + 99 others); Fri, 30 Apr 2021 20:27:58 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:36110 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231641AbhEAA1z (ORCPT ); Fri, 30 Apr 2021 20:27:55 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 6428229809; Fri, 30 Apr 2021 20:27:03 -0400 (EDT) Date: Sat, 1 May 2021 10:27:16 +1000 (AEST) From: Finn Thain To: Jiapeng Chong cc: willy@infradead.org, hare@suse.com, jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] advansys: Remove redundant assignment to err and n_q_required In-Reply-To: <1619774728-120808-1-git-send-email-jiapeng.chong@linux.alibaba.com> Message-ID: <516aeebe-f93-52e3-c554-bcb725bcf4dd@nippy.intranet> References: <1619774728-120808-1-git-send-email-jiapeng.chong@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Apr 2021, Jiapeng Chong wrote: > Variable err and n_q_required is set to '-ENOMEM' and '1', but they are > either overwritten or unused later on, so these are redundant assignments > that can be removed. > > Clean up the following clang-analyzer warning: > > drivers/scsi/advansys.c:11235:2: warning: Value stored to 'err' is never > read [clang-analyzer-deadcode.DeadStores]. > > drivers/scsi/advansys.c:8091:2: warning: Value stored to 'n_q_required' > is never read [clang-analyzer-deadcode.DeadStores]. > > drivers/scsi/advansys.c:11484:2: warning: Value stored to 'err' is never > read [clang-analyzer-deadcode.DeadStores]. > > Reported-by: Abaci Robot > Signed-off-by: Jiapeng Chong > --- > drivers/scsi/advansys.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c > index 800052f..f9969d4 100644 > --- a/drivers/scsi/advansys.c > +++ b/drivers/scsi/advansys.c > @@ -8088,7 +8088,6 @@ static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq) > sta = 0; > target_ix = scsiq->q2.target_ix; > tid_no = ASC_TIX_TO_TID(target_ix); > - n_q_required = 1; > if (scsiq->cdbptr[0] == REQUEST_SENSE) { > if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) { > asc_dvc->sdtr_done &= ~scsiq->q1.target_id; > @@ -11232,7 +11231,6 @@ static int advansys_vlb_probe(struct device *dev, unsigned int id) > if (AscGetChipVersion(iop_base, ASC_IS_VL) > ASC_CHIP_MAX_VER_VL) > goto release_region; > > - err = -ENOMEM; > shost = scsi_host_alloc(&advansys_template, sizeof(*board)); > if (!shost) > goto release_region; No, the correct way to resolve that particular clang warning is, free_host: scsi_host_put(shost); release_region: release_region(iop_base, ASC_IOADR_GAP); - return -ENODEV; + return err; } > @@ -11457,7 +11455,6 @@ static int advansys_pci_probe(struct pci_dev *pdev, > > ioport = pci_resource_start(pdev, 0); > > - err = -ENOMEM; > shost = scsi_host_alloc(&advansys_template, sizeof(*board)); > if (!shost) > goto release_region; > No, that would be a behavioural change for the error path. Moreover, the clang warning you claimed for line 11484 appears to be bogus with regard to mainline code. You may want to check your checker.