From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2507C04AB6 for ; Fri, 31 May 2019 11:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DEC724E03 for ; Fri, 31 May 2019 11:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbfEaLgq (ORCPT ); Fri, 31 May 2019 07:36:46 -0400 Received: from mga06.intel.com ([134.134.136.31]:10520 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfEaLgq (ORCPT ); Fri, 31 May 2019 07:36:46 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2019 04:36:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,535,1549958400"; d="scan'208";a="180297619" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.198]) ([10.237.72.198]) by fmsmga002.fm.intel.com with ESMTP; 31 May 2019 04:36:43 -0700 Subject: Re: [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0 To: Colin King , Ulf Hansson , linux-mmc@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190531113223.27474-1-colin.king@canonical.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <4336bf57-5fcf-5758-8d0d-9fd4aec3df4a@intel.com> Date: Fri, 31 May 2019 14:35:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190531113223.27474-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/05/19 2:32 PM, Colin King wrote: > From: Colin Ian King > > The calculation of slots results in a value in the range 1..8 > and so slots can never be zero. The check for slots == 0 is > always going to be false, hence it is redundant and can be > removed. > > Addresses-Coverity: ("Logically dead code") > Signed-off-by: Colin Ian King Acked-by: Adrian Hunter > --- > drivers/mmc/host/sdhci-pci-core.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > index ab9e2b901094..f70436261746 100644 > --- a/drivers/mmc/host/sdhci-pci-core.c > +++ b/drivers/mmc/host/sdhci-pci-core.c > @@ -2044,8 +2044,6 @@ static int sdhci_pci_probe(struct pci_dev *pdev, > > slots = PCI_SLOT_INFO_SLOTS(slots) + 1; > dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); > - if (slots == 0) > - return -ENODEV; > > BUG_ON(slots > MAX_SLOTS); > >