Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3471253rwb; Mon, 5 Sep 2022 12:17:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR5oVIbHtMt8z4dx1cMk8xBu+Wb7pOiQRwek2C4tOtG/IdzFM8wVV/HOUb7B3qsKQu3ykbLr X-Received: by 2002:a63:ef07:0:b0:42b:890d:acbe with SMTP id u7-20020a63ef07000000b0042b890dacbemr39754049pgh.425.1662405440943; Mon, 05 Sep 2022 12:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662405440; cv=none; d=google.com; s=arc-20160816; b=upgjp1ucMm38Wvmn1JT+hyofMkYqfd7jW0M93w2lj6Sef9z0249hk6AquG/tT0319J KHwMIXoz9BdChp9JLgeZESPwk0ZPQSXTYnj2ce8qvw8udL1jsrnOpcaYHWitfG3EHiWd EIz9YJ4cMTqdcxAjxRtamdHXCePtDE9gCpxHnGdrxxNIpUl0GhqItlrJV+bCQdLr4jGH tQyvLucu/kwkUpA3YxwuVkYlt8nUI0HbWQJWtJxK7x/jQt6lKQgODwzTpdDHDqcfoumm 3Wm6B2d7dUug8vHVQihnQ97iIMYQxC/1WM6aeFeZjMYoaqpHemKeCIaGAHyUBKYIXC2K Tc+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XAk5CpmLNAYNZycN3PgzvRFC7ERPSxN4O8zhAljzd8c=; b=p4oZ7GwbpJkgtyBBNm2KmaMZM0DtO06h5uxEj4J2yfyiM5tE1VmcEjLFGGfKwsF26Y hYTt6yN0z8NtRDwnZZPybZ8fKZDaRm4S4P/Xg6DgSrGs7B0gjbbO4dATqI67BsiIeXku HimG4+yPexX+vc34C+jKXotsF6wgbRJcejFosQTLsGsXxSRymmh/YSBtBjJvZFo12z29 A68nJ5P9DrHzf3R0Fh/YZwUT0r0KguUGkOL0XigsKS3sxVlb/oeDZRtaNt6zFyxqLAha HJOinEgJjp750owI/4Jlcd3kHhXUxbpIr8LXnY9oECnq/Fohlx+H+qhQUOrGedO2Z4cA +LkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nGJ9gClC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a630a0d000000b0041be4774a55si8114297pgk.800.2022.09.05.12.17.08; Mon, 05 Sep 2022 12:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nGJ9gClC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiIETIq (ORCPT + 99 others); Mon, 5 Sep 2022 15:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbiIETIm (ORCPT ); Mon, 5 Sep 2022 15:08:42 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6F73B958; Mon, 5 Sep 2022 12:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662404921; x=1693940921; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WwmzwywTSAN6ZMOyQiemN7PKzXK7Aa4TUDjqPx95sFw=; b=nGJ9gClCXbeTe0sGgjEqSJXXYetCVPrfmTS3Hgl50ZC41uh0ZpTrA6qb lOXuIc6BKAYtNn99/AeByusCPDreQXJ77MHuL2jx8IGEsyeiePd2KPdEE O1Eu4WF6r1n05M1qV1qBi9AkAbO6thxf0vWvhlk+HXKfcRszMrOT0ptjN /rL3FLoFH6zV+1+7/IVWt2Jv3xGSyqBPE1+tU0Ns6mS129H1ApzeZ8g82 dR4grUhBAa0TowoZ+01Uhxy/J8h4HigM9K7tbqgBkyEEaMF+DhsuN/kdo vQSg/6QKb69HouXoXfDgvSBRTNAF/gd60G0Sb6IoE67bpqcRwbxm1o2cb w==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="294028715" X-IronPort-AV: E=Sophos;i="5.93,292,1654585200"; d="scan'208";a="294028715" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 12:08:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,292,1654585200"; d="scan'208";a="609738324" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 05 Sep 2022 12:08:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id F1BE6101; Mon, 5 Sep 2022 22:08:52 +0300 (EEST) From: Andy Shevchenko To: Linus Walleij , Michael Walle , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Andy Shevchenko Subject: [PATCH v1 1/1] pinctr: microchip-sgpio: Correct the fwnode_irq_get() return value check Date: Mon, 5 Sep 2022 22:08:49 +0300 Message-Id: <20220905190849.73194-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fwnode_irq_get() may return all possible signed values, such as Linux error code. Fix the code to handle this properly. Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)") Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-microchip-sgpio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c index 6f55bf7d5e05..0771b743a940 100644 --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c @@ -864,9 +864,10 @@ static int microchip_sgpio_register_bank(struct device *dev, gc->can_sleep = !bank->is_input; if (bank->is_input && priv->properties->flags & SGPIO_FLAGS_HAS_IRQ) { - int irq = fwnode_irq_get(fwnode, 0); + int irq; - if (irq) { + irq = fwnode_irq_get(fwnode, 0); + if (irq > 0) { struct gpio_irq_chip *girq = &gc->irq; gpio_irq_chip_set_chip(girq, µchip_sgpio_irqchip); -- 2.35.1