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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 A9EE5C433E1 for ; Sat, 8 Aug 2020 23:50:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B28D206B5 for ; Sat, 8 Aug 2020 23:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596930636; bh=WY+eO/9Lahljm8HW8woM/npGtNCkHd0cv1BtYYsClx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IoG2J1SgIOGVkA9tdNu8AG3ONX5k76e6EwKnf6WS7/iG+MfhHaLa8g2Lh3qL2VlT8 Q04bqJnzfbEGMZ44EcUJkkDu2ceOvEpkKIkZ5VQARDYR+zn/gdcS2gEYJyOHXfc+ix sWP7kiu4qRdqLbaCVWjMvqTiAJQFsLlKwmfktVy4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728706AbgHHXuf (ORCPT ); Sat, 8 Aug 2020 19:50:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:49194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbgHHXgg (ORCPT ); Sat, 8 Aug 2020 19:36:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7749E20716; Sat, 8 Aug 2020 23:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596929796; bh=WY+eO/9Lahljm8HW8woM/npGtNCkHd0cv1BtYYsClx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saogdyKJo1qG8cIn2cht3KIxaC+EDwTettzFkt43W6XCG7/erulgQ8V/559HnFWQm 5zqj4wpR/VTnf9U4xDB6J8IE3RCSF/tEXGhP644SVkxM3H4nJcgcp1FWnOomInY3ct BunfTQ8qpnCzHV8T5GWepx/zT+vikiLcYnNGxxFk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: yu kuai , Alexandre Belloni , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 35/72] ARM: at91: pm: add missing put_device() call in at91_pm_sram_init() Date: Sat, 8 Aug 2020 19:35:04 -0400 Message-Id: <20200808233542.3617339-35-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200808233542.3617339-1-sashal@kernel.org> References: <20200808233542.3617339-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: yu kuai [ Upstream commit f87a4f022c44e5b87e842a9f3e644fba87e8385f ] 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 Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20200604123301.3905837-1-yukuai3@huawei.com Signed-off-by: Sasha Levin --- 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 074bde64064e4..2aab043441e8f 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); 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); + return; + +out_put_device: + put_device(&pdev->dev); + return; } static bool __init at91_is_pm_mode_active(int pm_mode) -- 2.25.1