Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp480025imn; Wed, 27 Jul 2022 11:22:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ueeSXh/iJrPVzKsBnQtdcWcWQH3ccT+N4RmirvdDaMGdcnC6Nr+X7cMoAZ8hbR3n66I27y X-Received: by 2002:a17:907:6890:b0:72e:dc8f:ad42 with SMTP id qy16-20020a170907689000b0072edc8fad42mr17882955ejc.683.1658946126574; Wed, 27 Jul 2022 11:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946126; cv=none; d=google.com; s=arc-20160816; b=VtbJmfIrPDxTihtvCi9ZXrd3P0RxApTWeZhiknWC634RU9NsEFO9Dy+m/4Wewe1tcx jGxVqrDk6wd8jy/k7nO1c1RHfiPpCQVc5+Gd8EdWbuaql6DC1+IDApT5q/OA6LMG6efE +4Vk8oLAbfkf5ijulA1aIsysfsm6Lv4Pe4cJHu2ObZz66xwb9fpZ9i8ehWmvRl8tNy6q 29jBuHqM+MXi+Y9O8oY2186VN229iUlSq5OP7aNTWvasDtjvaK740PwbKWQuc9aPGXyg shNZS8nqtE01QvCH4ash0u/6icR1mKu98g08gDA1csiAv5/WjuLM9rbkad5vfNmT2oAO Jhgg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gi3O40T2i0embffYhu5hghdY58K5uhS2+vvqGFPB0SQ=; b=LCj9jtrYFjNu/bIhLOcbU0AcoXUA8rNJBZsXTtDVklGy0/2Jrr5nxMt3+8Ae2CRsuL vhWWhiEhMPZfojrLGtocpxWgcyQGTtAuulSZp0m2Oq1+l9nTybYUIt/sf7mLGKQB0akt 79SDkso+cWVp1xn/IAAKcPPeqYfMoud2JD3S4p9XUqGeSCoW65dY+ZZ2NLXaTGDyWBiw mZ+wVSXQvqpdYsSFKncCZGyiiSCt3dGd9xYHtfOj8Sv1RjzoeOPrvIrke4Rw/esQ1Q8y 8hujnBT5mb4ggSigNF+BfaLHzAt1X8lDKkTkcJwawjSFhdLiBoUA35YFp+UjPZwpGzYq cknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BZKTiLki; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho9-20020a1709070e8900b0072b14352ab5si23827111ejc.537.2022.07.27.11.21.41; Wed, 27 Jul 2022 11:22:06 -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=@linuxfoundation.org header.s=korg header.b=BZKTiLki; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237609AbiG0QhB (ORCPT + 99 others); Wed, 27 Jul 2022 12:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238237AbiG0QfR (ORCPT ); Wed, 27 Jul 2022 12:35:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311FE56BA9; Wed, 27 Jul 2022 09:27:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFC2661A08; Wed, 27 Jul 2022 16:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE6C3C433D7; Wed, 27 Jul 2022 16:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939266; bh=/pJZDdtSjLMYmjrj2iJ114/3Aq098YfIz1ke9k5SAXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZKTiLkidI0nE/sgphZ2kqEzQeN1v/JcyZGzUZrl4no7wufuKxbJUSUYhjHNQr6uy 6S1iwHiqWn36f/g8mZhCRyCo3olpw+FBhHR4SaOOqcnUN4xFwgyqJS0k8HViSdkkAh PXnMpfDEvYaO/rvdDem3td8hG2gf2sM08yhZB1Ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabien Dessenne , Linus Walleij Subject: [PATCH 5.4 01/87] pinctrl: stm32: fix optional IRQ support to gpios Date: Wed, 27 Jul 2022 18:09:54 +0200 Message-Id: <20220727161009.047532692@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Fabien Dessenne commit a1d4ef1adf8bbd302067534ead671a94759687ed upstream. To act as an interrupt controller, a gpio bank relies on the "interrupt-parent" of the pin controller. When this optional "interrupt-parent" misses, do not create any IRQ domain. This fixes a "NULL pointer in stm32_gpio_domain_alloc()" kernel crash when the interrupt-parent = property is not declared in the Device Tree. Fixes: 0eb9f683336d ("pinctrl: Add IRQ support to STM32 gpios") Signed-off-by: Fabien Dessenne Link: https://lore.kernel.org/r/20220627142350.742973-1-fabien.dessenne@foss.st.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/stm32/pinctrl-stm32.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -1215,15 +1215,17 @@ static int stm32_gpiolib_register_bank(s bank->bank_ioport_nr = bank_ioport_nr; spin_lock_init(&bank->lock); - /* create irq hierarchical domain */ - bank->fwnode = of_node_to_fwnode(np); + if (pctl->domain) { + /* create irq hierarchical domain */ + bank->fwnode = of_node_to_fwnode(np); + + bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, STM32_GPIO_IRQ_LINE, + bank->fwnode, &stm32_gpio_domain_ops, + bank); - bank->domain = irq_domain_create_hierarchy(pctl->domain, 0, - STM32_GPIO_IRQ_LINE, bank->fwnode, - &stm32_gpio_domain_ops, bank); - - if (!bank->domain) - return -ENODEV; + if (!bank->domain) + return -ENODEV; + } err = gpiochip_add_data(&bank->gpio_chip, bank); if (err) { @@ -1393,6 +1395,8 @@ int stm32_pctl_probe(struct platform_dev pctl->domain = stm32_pctrl_get_irq_domain(np); if (IS_ERR(pctl->domain)) return PTR_ERR(pctl->domain); + if (!pctl->domain) + dev_warn(dev, "pinctrl without interrupt support\n"); /* hwspinlock is optional */ hwlock_id = of_hwspin_lock_get_id(pdev->dev.of_node, 0);