Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp539896rdf; Fri, 3 Nov 2023 07:59:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOpjoETbFcI3af/Hvpkih19NwbDNMb7WTikVt/c6sPG9JuO355nTbjEYcF6vnMS5smGpB3 X-Received: by 2002:a17:902:da82:b0:1cc:52b5:8df8 with SMTP id j2-20020a170902da8200b001cc52b58df8mr3460215plx.26.1699023540293; Fri, 03 Nov 2023 07:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699023540; cv=none; d=google.com; s=arc-20160816; b=AQFfcglrl1Wy6v1TdjGUgUacTW9qokWRycKHZWQ4aT3vsQcHK/TpCLofMo2qqkOdkE TXUGbRX07eBzxpoWsuYIwN3vPVEe4LKyJA8lBFNpoiRXiC7GxRXDnOgv97UsqiYOklfQ phfgBR4SUgo5PNLBNBap1X+yDkMqJ21G0dvrJdpGTBgLBRFMscDPWgWIjW/LysSFvxSe VCe5bFO1ZIvxQxaB3QcIQH6ABZBM9jpGOxWhT4Y8ahuk7EGMamuK1qgYPzG1I29gJ3rm cZC0z13AlbECORdjJPTEVH7/ocUGjkzY1ll0Cr++GuDjFBitJyWseBGWl43zs/NZk7IC gP8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=T5F/ReO76xi/d2SJ8t4KcxaEPiUh7fRwP/CdxjGwwrk=; fh=VahjpW1zWwf7XRVJcqjG1vES+HcRWkmXRh/RIC++dlg=; b=PjeCCN01NR34MiKKhQPPASqpuNWfXhCpNg50ZwiNgCgtd0kYpXPts79yzFi0ojbWNE bcxV6htha7b6zik/9OyrR32wPgiWlXLzsPsJy7vd594B6zdgfmC65Nxw0OOlbMQ1iufh K/b7PkuYX+sO3OSxZGj0Uqsg7z4q+KtPp6T9RA3WUWZghSpkns1eV03A5XYzoHph3pST wDVf5WfmZENSpx/zWq0++qt7yZ+SLqQpT3z89CdS0LjXZxjAp4WKhY29AWWDX1Zmq1A+ r0EB7TFMJl83n/eGDYUtm/FMArjp2aBiK2AHjOgYgJSftiIjrkq9Xui1R+hrVSd+I/rY ufkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D7FlDwl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l11-20020a170902f68b00b001b8921fbd87si1679099plg.490.2023.11.03.07.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D7FlDwl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 86FA6806AFD2; Fri, 3 Nov 2023 07:58:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232342AbjKCO6j (ORCPT + 99 others); Fri, 3 Nov 2023 10:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjKCO6i (ORCPT ); Fri, 3 Nov 2023 10:58:38 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DB46D47 for ; Fri, 3 Nov 2023 07:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699023515; x=1730559515; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=n4Ft9Khqw6FLR8Iq73ZS5MUfE2ucW9GHgqqIE2K9DSQ=; b=D7FlDwl3DI0sDG2yZfX5xFrX6y3/4rU4dC0pTJDuaIWDks4/UoTzAjIH BqGZoB/z3Bn3RCWNe2YtZTy2h3tSAi7vwj/lyns93+HCQZ5BrH7q+JUGO E+c3C13GARqTanj5ZA3SKa60nvKTtI/068sA9/XWaSCsUw75MM9WSDImZ 6F65wvqzczG+c3TIt+puMqw72Hv3qqabi591Dm9sRpOogELYN2Yv0shIC nndBXO4L5j9NjqOpU3335Rk8bX67OIL+2UnY4Jgowr248Zm8fkcQuVwAf P7MCJW9FJJp7bA5Wb7nIQYGhl3qyCfY6TYzP+jhjPJBxhmq10ILPjBYqZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="373994953" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="373994953" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 07:58:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="796638792" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="796638792" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 07:58:31 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC3) (envelope-from ) id 1qyvcy-0000000B32M-2lAq; Fri, 03 Nov 2023 16:58:28 +0200 Date: Fri, 3 Nov 2023 16:58:28 +0200 From: Andy Shevchenko To: Mika Westerberg Cc: Chen Ni , lee@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mfd: intel-lpss: Fix IRQ check Message-ID: References: <20231101062643.507983-1-nichen@iscas.ac.cn> <20231101070310.GF17433@black.fi.intel.com> <20231101104717.GH17433@black.fi.intel.com> <20231103064140.GP17433@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231103064140.GP17433@black.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 07:58:55 -0700 (PDT) On Fri, Nov 03, 2023 at 08:41:40AM +0200, Mika Westerberg wrote: > On Thu, Nov 02, 2023 at 02:38:31PM +0200, Andy Shevchenko wrote: > > > > > > - if (!info || !info->mem || info->irq <= 0) > > > > > > + if (!info || !info->mem) > > > > > > > > > > This check (info->irq <= 0) covers both "invalid" interrupt numbers > > > > > (that's the negative errno and 0 as no interrupt) so I don't see how > > > > > this change makes it any better and the changelog does not clarify it > > > > > either. > > > > > > > > It makes sense. The IRQ here may not be 0. We should actually fix > > > > the PCI code to guarantee that (platform_get_irq() guarantees that > > > > in platform driver). > > > > > > Yeah but I mean the check above handles any "invalid" interrupt number > > > just fine regardless. I don't see any point changing that. > > > > The point is to have proper error code to be returned. Currently it's shadowed > > in this check. > > Looking at this more, this patch actually introduces a bug. > > We pass pci_dev->irq from intel-lpss-pci.c and that comes directly from > PCI core that assigns it in pci_read_irq(). This value is unsigned int > for starters so it is not designed to contain an error code, secondly it > can be 0 meaning "no IRQ" either if is SRIOV device or the interrupt > line is not assigned. I actually think SRIOV is a possibility for future > LPSS devices so we should be dealing with this properly. I could argue that this patch _reveals_ the bug in PCI that needs to be addressed. -- With Best Regards, Andy Shevchenko