From patchwork Sun Aug 25 18:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13776865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6205DC5321E for ; Sun, 25 Aug 2024 18:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=raI+n19QFN29zfHeug6+Nnj8oFJHmaYrdY3f2jmORFs=; b=IbHsJ8uO37vs0N/A7ZL94lDIRZ 9HB1jJhmt3tofFeOYOImlxufw1TYGvSFbdnImBz+TBDfS6vT8sP8Sf4BbiHccJHvvAjlp9/pI+8bz fU4TMya4Uk+dzMAZh2txbqtjExFvtIMYjSU1cV1eQGIYlZH9haz80v2A5/cqBaqex78M9xm8w3/Z9 Q6Rz00VOK6r9r6UHvQqInJw5Wrq3qXQGWSWNeh0V2IkDMgskcq5p6B5GqYc2cvsxp+dTj2nFTJca3 lI2ya1j84+s977+edmQCB0EYrir+L8+7ScvOepNnmmwYtc1LuhuYJMgd1t/A4wKjYNAibZ+t1XzlT mL0DLG3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siHfc-00000004mJt-3hPf; Sun, 25 Aug 2024 18:08:56 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siHci-00000004lkD-1nsn for linux-arm-kernel@lists.infradead.org; Sun, 25 Aug 2024 18:05:58 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4280692835dso5571565e9.1 for ; Sun, 25 Aug 2024 11:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724609155; x=1725213955; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=raI+n19QFN29zfHeug6+Nnj8oFJHmaYrdY3f2jmORFs=; b=hOCNeHxqfg3k1V5gO5J3WxMLZp/ArTPc0QMIqI0DOp5a/wFjTB3BO9t2xPgwGSdB/p sCxIShQE/PqG/uT1+gsLBnGZ9QyZTvoFmZgWkgwe+k9iiRUz0cMdPQJTjtg0uIAUCWbT z7TMiGRsQczLHJziNzq4dXRKb4mIVVms+2hpG/NjUu2SlA7OikeZB+Ef0Ac+gdAN2Rn/ pP1jO19iKdmKRy3lLW/ruApmHusZwT1LLvLIVKAYpE3vhvxVp3B4LTehNRyl/wnpW1Zi 5K9yH7NAx1I2XK0EQENEXo2Yiq9v9WsPmeIKqsmqdF675zm1soPSlnNv1QHINNl9TDjG cOww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724609155; x=1725213955; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=raI+n19QFN29zfHeug6+Nnj8oFJHmaYrdY3f2jmORFs=; b=oO3RawkXfySy78wXcPNeLkjnfFfNDvx1zpIQEvryqQ6QYIQHyKubzg7sNgqK9CRb3X 2zI7kIKLXS7nZM8iDAoeOodkw4Qda0kJ3HedU9qg1IQf4vrLq5O7HHC3wE3HpnEfMUzl 50pzMzHCBZPYcJGyHf0qwsNpQbQRCMRr6JEliNitbjLN4YN6eVj1LyZKZoqjOGIXT8RU DgC5SzlwFYwthseZhnt5wf6f6zmZG+96ehpw76HY3lcDWavr+9swqatUqa5TQoCayuBf 5itidbvSR3AT+s+EqrC4b2T69S+j4sVRnQWHQP4venigINSzKvV9enY1iUxJ+MgLvwPs ACfw== X-Gm-Message-State: AOJu0YwrtCaefqM29SNmg+d6KAGCkelkW/wSdHSGcik+VvPbWzG2baDi yFeeWAQTZPXVD/qfwqdxjMByH6caqp1WuCiILdGKHXngqU4PevZTq3iTwiyqD7w= X-Google-Smtp-Source: AGHT+IHovd9hBkcFA5+INtvXNRkDasxTeWwT194C24emqMwQsIKUln2/CHtoq+dBH9VjU22j1a5wgA== X-Received: by 2002:a05:6000:18a4:b0:367:811f:814c with SMTP id ffacd0b85a97d-37311852228mr2891104f8f.4.1724609154471; Sun, 25 Aug 2024 11:05:54 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37311dca113sm6438736f8f.16.2024.08.25.11.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2024 11:05:53 -0700 (PDT) From: Krzysztof Kozlowski Date: Sun, 25 Aug 2024 20:05:24 +0200 Subject: [PATCH 3/4] soc: versatile: realview: fix soc_dev leak during device remove MIME-Version: 1.0 Message-Id: <20240825-soc-dev-fixes-v1-3-ff4b35abed83@linaro.org> References: <20240825-soc-dev-fixes-v1-0-ff4b35abed83@linaro.org> In-Reply-To: <20240825-soc-dev-fixes-v1-0-ff4b35abed83@linaro.org> To: Linus Walleij , Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1464; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=djfTpzgwI9VayrirIxvL2d17DNLj3Y9kYYllCM4F/9I=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmy3J5hVAjigtLPRzXJclE2hY3l9wqGiPuN90+6 VH3b32MKzKJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZstyeQAKCRDBN2bmhouD 1z6YD/4gu3mtH9IEh3ZQSvcoj0sIV5F5wo+z0K9BmcsSZ8OvhLEiUikWAeTcuLAhbgrn5gzoTq6 UNEzpe0Yo0SWsrpyYm5izi/pKTuvMt+RZtGft0HXS+P8EP0L1A4kFAQ4OJcyUPiN9wqkMqsCYKH LdyWHVivtTiQc/iirLNAAqEi6hlPgzGfxveGpcqqGnN+Wb6jk1OMB14UTc19pUbRO//gV8zlRaB 9HUtRYAB9LySEgj/dgH+Iip/I3nUyn8wW15yC9ZWFBl+KnENa1k/5jHLRqslK5TdSxHeLZmrrzW Zw/fgTZUKKt3Uq1hwZGbpqIT1RHsojTQ1uYH72sJXC+v62+B/1kaUrNrO7Ckhi6KCtSvY/u7QfL 6cn8UtXArp0XU/uHpfKCsFov/Gm6pKy5vQOT3KrOcY/K+LtrKxjbT6SQf8J4oYBSRuTJNIKfw4k v3XkaOxOhKZd0auFGwodSa6Dm/GCoV3Tr6Yx7+mqEiHduB3dTeJ30fsHjWllbBI1gdFEs/Fu6cj enC33MxBkGrsuD298hQViVZbeMOnK5huRM/M62eW3PuYAs+cE+MAZcztvReOZ7WWhsYST95kg4k O2Bk0sCgt26/4NpMbpPjYsc4KN6d8lm8NOhbMOxYoEvJF1q4RhmPsfAQ9qsSpH6YI3zEwBsXKHO 6FLUwK897TPmYQA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240825_110556_531471_6A5F6CC4 X-CRM114-Status: GOOD ( 14.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If device is unbound, the soc_dev should be unregistered to prevent memory leak. Fixes: a2974c9c1f83 ("soc: add driver for the ARM RealView") Cc: Signed-off-by: Krzysztof Kozlowski --- drivers/soc/versatile/soc-realview.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c index d304ee69287a..cf91abe07d38 100644 --- a/drivers/soc/versatile/soc-realview.c +++ b/drivers/soc/versatile/soc-realview.c @@ -4,6 +4,7 @@ * * Author: Linus Walleij */ +#include #include #include #include @@ -81,6 +82,13 @@ static struct attribute *realview_attrs[] = { ATTRIBUTE_GROUPS(realview); +static void realview_soc_socdev_release(void *data) +{ + struct soc_device *soc_dev = data; + + soc_device_unregister(soc_dev); +} + static int realview_soc_probe(struct platform_device *pdev) { struct regmap *syscon_regmap; @@ -109,6 +117,11 @@ static int realview_soc_probe(struct platform_device *pdev) if (IS_ERR(soc_dev)) return -ENODEV; + ret = devm_add_action_or_reset(&pdev->dev, realview_soc_socdev_release, + soc_dev); + if (ret) + return ret; + ret = regmap_read(syscon_regmap, REALVIEW_SYS_ID_OFFSET, &realview_coreid); if (ret)