Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8216313rwp; Wed, 19 Jul 2023 06:57:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvte9xX/q7usSL5bfrC/KjupVLerLfi6i/9Qw4P1GquOTa/oIb+cxHQwAyw7ni/BHy6nFX X-Received: by 2002:a17:90a:280b:b0:261:49b:d65 with SMTP id e11-20020a17090a280b00b00261049b0d65mr18592964pjd.28.1689775058710; Wed, 19 Jul 2023 06:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689775058; cv=none; d=google.com; s=arc-20160816; b=Da1njzSd67+8akpEsbvZ7+oANQ8VqQlSgVSuQKeojkjH7Id5JNG/Yuh1xLqXz79CcG LUgW02zy6ysSl3uEMOJeSHb2JcmXSSrvVtXnFN/ZcNn6k1Ig0WKvq3md38Vep2U13BPX wJzlfrWsRZDE01nqj44LiGUaQ5aou5vpTdA8Cxb0CG/P+FAPaXlZh8E/aPDQezOla9JE jnNYH7mm+JqaPbRyjEyKxKiVKQcaByKTiH5x2x1gAj3zTKozvtV6EFaG5qFI0ooUKpgE +gQw7LWMKCUzygt6vhT39fk/SYxsU7w3Jts2y8AzdP9YMv/Usd9nkysLs6uit9k1OhQ0 Vmbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=flEwfn9BpI6GLbTD9ZQxNq/h4BeiJLyxxD5aIyE9kIA=; fh=lcSkCL17BoW7RaaohSaqFmZHKJcODVq7k25ANhJ6GOQ=; b=JJoj65MAKWgaOKAHuEprYRbDRHYoF5yoXEF4fZcEYh+YzKoYLhPhhXO0x6ljgHC9OJ fDu+1iwyOjm58L8xIUgRyqhnd5lRXSN/VYM4nWJbUVS8hb28sIl+ip4RbZLZQwVek+6i 7fS4M5atLVooUm7/NumuJIN6AcTG+IxTppbaHmjR6I6Nk1SMG8sdmETUcHvl0JgucdTF PiwjpwpoVRxcNbsEJKXKsLCPQi+n0FklNWMVuyxI2tDlBBWAk3XENyv4r5kmHNI1k5Od DZDy8hhwcKsGh5ZGxPc+29haIX7aBwgP3D2aVagL1iIG4xluxhlskikgVBdE5S0oOgeW xPSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=wRtkVyr3; 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 k1-20020a17090a590100b002634977e6e7si1383092pji.102.2023.07.19.06.57.26; Wed, 19 Jul 2023 06:57:38 -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=wRtkVyr3; 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 S231272AbjGSN2L (ORCPT + 99 others); Wed, 19 Jul 2023 09:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbjGSN2G (ORCPT ); Wed, 19 Jul 2023 09:28:06 -0400 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3F3CD for ; Wed, 19 Jul 2023 06:28:04 -0700 (PDT) Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-4815756d742so2090669e0c.1 for ; Wed, 19 Jul 2023 06:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1689773284; x=1690378084; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=flEwfn9BpI6GLbTD9ZQxNq/h4BeiJLyxxD5aIyE9kIA=; b=wRtkVyr3297wr6GJR9LD3x3GIr5dtP27Y+0VJvbyN3UOp/Img7GGPZ/uPuw1DyQPgR yiuD4isYWpQyy3Q/+6V/PBssPy42oq5nGo34HEl0y8Idn1Z3jBpEM049BBl2y3JxxiFj ZHhVirPxt30HWnZf5WhykMaAQOxHyGOCwckV9xephk8QoL6FArRXhGDX59NVKekiY3lC /Pjyd9EP5ao2vdAVqYWIkpCdx9lAebS/j6bkVM0+BsNcl74Lpkr4mGIrVQ0IW5JEExTm lBEbXg+AbZFIPqPsMKMO4MtaQwyUEFHcOM+iM9RLCN0dN+AMkg/oR6IVBFv88BrwcR8d 4tiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689773284; x=1690378084; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=flEwfn9BpI6GLbTD9ZQxNq/h4BeiJLyxxD5aIyE9kIA=; b=RRpAFb01ydz+3VvCfNzpdvHwiWlHa69Dj2960pQQnNVO/CG+apwdGwRdigAPAT5O18 iQsCqFXu09jwxCX1v4/j6X7S1Z/ybZRKyh3KT8ePU/0iZO+6YAzJP/lV2D0hG1BQ8qTc 5+WUdRIF1BAusEp/gm3dQM6Ew2qOON2bbX0l0fUDLvasAPU+9y6IOhIErUMPwKjpbm18 qMgecpWbXvF4R9or4occfROF9RX4MBSaT1xgd32IzfS4c0u4wWSzFloDy6mD2lsTaPIZ rtZK+ev3SzqZSeXhDRwLM4NHQZq1uWk/kNMic6sPr9Bo/Cs4e1O4sVKFdyBZ+sKz4qWZ kxGw== X-Gm-Message-State: ABy/qLY32TozW/5xnmHkc3hOTgYd8P4EAkJZ9L0Bv/K+sxwwGnbn51gf E7r4HajU/BL8tz9Nny89K/MOZ/95oJdxGPOEsLgmpQ== X-Received: by 2002:a1f:d087:0:b0:471:b557:12a with SMTP id h129-20020a1fd087000000b00471b557012amr3157493vkg.11.1689773283085; Wed, 19 Jul 2023 06:28:03 -0700 (PDT) MIME-Version: 1.0 References: <20230719114101.55051-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 19 Jul 2023 15:27:52 +0200 Message-ID: Subject: Re: [PATCH] gpio: mvebu: fix irq domain leak To: Andy Shevchenko Cc: Thierry Reding , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Linus Walleij , Andy Shevchenko , linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=unavailable 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 On Wed, Jul 19, 2023 at 3:03=E2=80=AFPM Andy Shevchenko wrote: > > On Wed, Jul 19, 2023 at 2:41=E2=80=AFPM Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > Uwe Kleine-K=C3=B6nig pointed out we still have one resource leak in th= e mvebu > > driver triggered on driver detach. Let's address it with a custom devm > > action. > > One nit-pick below, in either case > Reviewed-by: Andy Shevchenko > > > 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 platfo= rm_device *pdev, > > return 0; > > } > > > > +static void mvebu_gpio_remove_irq_domain(void *data) > > +{ > > + struct irq_domain *domain =3D data; > > + > > + irq_domain_remove(domain); > > The from/to void * doesn't need an explicit casting in C. This can be > a one liner > I know but I prioritise readability over brevity. I prefer this version. Bart > static void mvebu_gpio_remove_irq_domain(void *domain) > { > 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_dev= ice *pdev) > > return -ENODEV; > > } > > > > + err =3D devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_= irq_domain, > > + mvchip->domain); > > + if (err) > > + return err; > > + > > err =3D 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_devi= ce *pdev) > > } > > > > return 0; > > - > > -err_domain: > > - irq_domain_remove(mvchip->domain); > > - return err; > > } > > > -- > With Best Regards, > Andy Shevchenko