Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8060050rwp; Wed, 19 Jul 2023 04:50:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4FnZFDefZcBmdDV/qcOOQtsxDB3G4qPcfW5D7tlqf7lkzx5q1CHplC7T/p/gE2obq5uKh X-Received: by 2002:a05:6a20:9185:b0:134:1924:e197 with SMTP id v5-20020a056a20918500b001341924e197mr2441436pzd.8.1689767433896; Wed, 19 Jul 2023 04:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689767433; cv=none; d=google.com; s=arc-20160816; b=ZEcHn+fvmBs3L9bUqcqZZzzgKJvcr/AMJlDIu6gYR3GxS8IzADV4NudtZn6dh1mR4C yLdODCOJ5O9A+o1+aNrg5hKafu4oerigv2qtW3yMnjAN5Bep4HUBLXDbmfWuQxUrgwUg woHzJx/LdKFFSgmQti4pqnOlnhe7vKbdjHs0Im+MbfD5IIEt/HuuJZabAlXrDs9GTahG NOh+VtYL7RDHFaSNmFVZpfL1zj0nWgK8cyFx03GIoGp872gpis65msZxYixd+4h/AJ02 KqW624pguURYiFwF2Zfdql+9CyGwo3mr4ueJblTaiITqrAYpgFsebMDo6AfQXzG9R41Q PNcA== 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=omclyAfkGRQWS2BiKQCx7pDx212Hyui8qaS7KiVV4jA=; fh=8S3+6IX7waud2SYQFzSItq9xQ4hfc2k07kl1yNav1UA=; b=BbQ7UVq1pdE4mLqFgufYSmZqzbPD+aXgLh2MqSSh/2tzRS3ziq5g6uTQERiecA1Zc9 zOcuIo2V/anejSRds0KNp9plukXIpE/419Eh4h0gACik//XUqD9aBi0coXND04CgYC5p NlnYUN1z0F6D9ASl7WQSItmdA/fzJ33x1iLgFh/Vg5mbpbMgamYydkBPUukcdgG56VSR 7TunDCYz1Bef3flcCafoi1h0BFg62ezpFuezqNvpHuUchIUBwkd/02ERPMWi2WOCU/CR IjPGmXB9VPkrxu6dL4n7p1D3EBWNoKn2ifPRPeWvTU3YE6CggsQnVZi3TKywWle5ky92 datA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=asvioqTl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m68-20020a632647000000b0055b52ba0a00si3228582pgm.48.2023.07.19.04.50.21; Wed, 19 Jul 2023 04:50:33 -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=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=asvioqTl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbjGSLl1 (ORCPT + 99 others); Wed, 19 Jul 2023 07:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjGSLl0 (ORCPT ); Wed, 19 Jul 2023 07:41:26 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C500125 for ; Wed, 19 Jul 2023 04:41:11 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbef8ad9bbso67965835e9.0 for ; Wed, 19 Jul 2023 04:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1689766869; x=1690371669; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=omclyAfkGRQWS2BiKQCx7pDx212Hyui8qaS7KiVV4jA=; b=asvioqTlybWzOybciqN1ksH9D2IA4G3XyJNfKHI6nskJTHwCNROLCkZIv6WQMghL9d F/UumjmxH8VAADIo11xP6AFf7qgsbZqunQA6bzET8dmqqL4IdflaAbHMIxy5ZGR+ZFZt 81SGf3Fv6zhzOH9/ijWOwxmkAyvP+ov8dIoq/RbiHcORZfKlGc66mrGJyAYTLVDV9eML 7+wmoaQaKrBOeWdfBBzAJeRdmlltzIIB8wgEbKcMVpjXbth6hTgn0oXCpNiRDSmRrex+ wZnQT1z7EgtJtThH8crfTbBehz8pgAzYk5CERU/uHQkvthyrWInzdJQhyfi6Oc14te0m ZXOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689766869; x=1690371669; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=omclyAfkGRQWS2BiKQCx7pDx212Hyui8qaS7KiVV4jA=; b=MtrW6dXSgdePHHFTwQDDKxrxbed3AQSObk7PrI42uVflF6iu81+P6JzvdHoczlyoo4 VIVpKMcQnrOAN3u5E/847VDuPnTmn6LoywBRjP0Ett+cvk+2FqxEipjvMdT0nqs68QN1 F5oUbN7Kr4Q1S0+DVL17f8EjqkWWZ6fhUAyeD1m47rVyOV5Y0kTBx1/J2Yqnh0rR8iP2 R+zhFPUdjzJk6YfgW8Oxg1SumgW+/l09ZZX8/F5wuzEbKOrGb0KNiWaWteYBxT7pcREY Cu7rKsSawoWXarSR1pguZnWTUtnRGDmeiJrM+cmiBj6YMGwtKhRnLJaXlEIByqOJMMt1 e1Xg== X-Gm-Message-State: ABy/qLazjv3rygn8nAJuRHYKrZBLOW3p5p8dbQjmlMH+UiWYl2+PuTsa DcOb+9hAWTIsR+lqSXtpCgad4Q== X-Received: by 2002:a7b:ce16:0:b0:3fa:9e61:19ed with SMTP id m22-20020a7bce16000000b003fa9e6119edmr1874710wmc.23.1689766869358; Wed, 19 Jul 2023 04:41:09 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:f884:f48d:2867:5c1d]) by smtp.gmail.com with ESMTPSA id o10-20020a1c750a000000b003fbb346279dsm1485644wmc.38.2023.07.19.04.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 04:41:08 -0700 (PDT) From: Bartosz Golaszewski To: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Linus Walleij , Andy Shevchenko Cc: linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH] gpio: mvebu: fix irq domain leak Date: Wed, 19 Jul 2023 13:41:01 +0200 Message-Id: <20230719114101.55051-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,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 From: Bartosz Golaszewski Uwe Kleine-König pointed out we still have one resource leak in the mvebu driver triggered on driver detach. Let's address it with a custom devm action. Fixes: 812d47889a8e ("gpio/mvebu: Use irq_domain_add_linear") Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mvebu.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index a35958e7adf6..67497116ce27 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev, return 0; } +static void mvebu_gpio_remove_irq_domain(void *data) +{ + struct irq_domain *domain = data; + + irq_domain_remove(domain); +} + static int mvebu_gpio_probe(struct platform_device *pdev) { struct mvebu_gpio_chip *mvchip; @@ -1246,13 +1253,18 @@ static int mvebu_gpio_probe(struct platform_device *pdev) return -ENODEV; } + err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain, + mvchip->domain); + if (err) + return err; + err = irq_alloc_domain_generic_chips( mvchip->domain, ngpios, 2, np->name, handle_level_irq, IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0); if (err) { dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n", mvchip->chip.label); - goto err_domain; + return err; } /* @@ -1292,10 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev) } return 0; - -err_domain: - irq_domain_remove(mvchip->domain); - return err; } static struct platform_driver mvebu_gpio_driver = { -- 2.39.2