From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52685C433E1 for ; Fri, 17 Jul 2020 22:57:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1DC4E2070E for ; Fri, 17 Jul 2020 22:57:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eJ7isdYO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DC4E2070E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Bm2CoxwyL6v4jbJxuvAFl9KPyXwkIaNsrk9JvVXWk/c=; b=eJ7isdYOpLiPMjcNHyUMerhG9 IIx9LEYQgh2+ocnE8Ha5orbO1fy4Lbg/yw2aSYbSq3Asadr8v5SC7UoVHjNhp5X31nGVDdpbSEee4 dAWPp/dqJtQeykbaXjXaWMg+x6zX8yA+qh0lDML4/PvYvCgwTJknYvR1CcVthoFgmx2AwwxjDQnQY cINgyccE8IdFyk3uhKKR3uXulgradJQ88JFlwVXgC69QRV6kgMC0dX6FAbKtxMYuT12WaT35ayRHB b9avvlf6XL9dTtc4jN1Yhbo9dfxYQ8Rix9G0e8mOkXccmWHh+mAEHs6Ji/14TvDmUoHWNwsBm4on5 oxKmkeRIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwZGg-00018f-Ky; Fri, 17 Jul 2020 22:55:50 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwZGd-00017r-1k for linux-arm-kernel@lists.infradead.org; Fri, 17 Jul 2020 22:55:48 +0000 X-Originating-IP: 90.65.108.121 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 6DEB7E0004; Fri, 17 Jul 2020 22:55:43 +0000 (UTC) Date: Sat, 18 Jul 2020 00:55:42 +0200 From: Alexandre Belloni To: "yukuai (C)" Subject: Re: [PATCH] ARM: at91: pm: add missing put_device() call in at91_pm_sram_init() Message-ID: <20200717225542.GZ3428@piout.net> References: <20200604123301.3905837-1-yukuai3@huawei.com> <20200702200915.GC6538@piout.net> <01fd6279-524e-3cee-4c16-5b748a49d0f0@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <01fd6279-524e-3cee-4c16-5b748a49d0f0@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200717_185547_247490_84AE809C X-CRM114-Status: GOOD ( 19.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yi.zhang@huawei.com, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, ludovic.desroches@microchip.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/07/2020 09:15:20+0800, yukuai (C) wrote: > > On 2020/7/3 4:09, Alexandre Belloni wrote: > > Hi, > > > > On 04/06/2020 20:33:01+0800, yu kuai wrote: > > > if of_find_device_by_node() succeed, at91_pm_sram_init() doesn't have > > > a corresponding put_device(). Thus add a jump target to fix the exception > > > handling for this function implementation. > > > > > > Fixes: d2e467905596 ("ARM: at91: pm: use the mmio-sram pool to access SRAM") > > > Signed-off-by: yu kuai > > > --- > > > arch/arm/mach-at91/pm.c | 11 ++++++++--- > > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c > > > index 074bde64064e..2aab043441e8 100644 > > > --- a/arch/arm/mach-at91/pm.c > > > +++ b/arch/arm/mach-at91/pm.c > > > @@ -592,13 +592,13 @@ static void __init at91_pm_sram_init(void) > > > sram_pool = gen_pool_get(&pdev->dev, NULL); > > > > Isn't the best solution to simply have put_device hereHi, Alexandre ! > > I think put_device() is supposed to be called in the exception handling > path. > > > > > > if (!sram_pool) { > > > pr_warn("%s: sram pool unavailable!\n", __func__); > > > - return; > > > + goto out_put_device; > > > } > > > sram_base = gen_pool_alloc(sram_pool, at91_pm_suspend_in_sram_sz); > > > if (!sram_base) { > > > pr_warn("%s: unable to alloc sram!\n", __func__); > > > - return; > > > + goto out_put_device; > > > } > > > sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base); > > > @@ -606,12 +606,17 @@ static void __init at91_pm_sram_init(void) > > > at91_pm_suspend_in_sram_sz, false); > > > if (!at91_suspend_sram_fn) { > > > pr_warn("SRAM: Could not map\n"); > > > - return; > > > + goto out_put_device; > > > } > > > /* Copy the pm suspend handler to SRAM */ > > > at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn, > > > &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); > > If nothing is wrong, maybe put_device shounld't be called? > I don't think this is the case but as the reference implementation (imx6) is carrying the patch, I'm going to apply this one. A better fix would have been to also factorize imx_suspend_alloc_ocram, imx6q_suspend_init, socfpga_setup_ocram_self_refresh and at91_pm_sram_init as they were all copied from pm-imx6.c -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel