From patchwork Sun Feb 27 13:53:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 547556 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 53342C433F5 for ; Wed, 2 Mar 2022 08:38:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9190A1B1E; Wed, 2 Mar 2022 09:37:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9190A1B1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646210299; bh=hDUEkEti21QWLOUXh8uIbAuSDqVDZrT2UDcBWNKQIzQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YGobUDNJByH8eqFU3z0gtUlq8Vs3BbKpW1y8ne7Iwtvqd37FRo0GiF7li0ybqphqI vZPrLkTnPBznj89QBwTOrlGvGK5qD6Os+zgLQt0WtBNc5ef8xI5ID1rX5RIIxxVH45 ua82a6+LKiCY6VqumuzBZo7bxirUZnjPHMBWf3+U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 08ECEF80558; Wed, 2 Mar 2022 09:33:45 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 621B5F80155; Sun, 27 Feb 2022 14:53:52 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 37DBCF80128 for ; Sun, 27 Feb 2022 14:53:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37DBCF80128 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="UBqOlB4p" Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id BDD753F1D9 for ; Sun, 27 Feb 2022 13:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645970029; bh=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UBqOlB4pGy6X1cyLk3f2ac2tqaRq6vSwQyW6pAocGcLbhY0xzEJhLQ6sf0IFqGkOS +B7TwQg48HE1rlMavu9dbZPQNOGk1tlJlclv4+sekt9TMJp3w1UnF/m0gR8frhfRob QB5mQHqTozT2kyTZIo7fCRtrRJ2kZ9uFt18cnqwqCveLFF+S4ZRbi1rCNC3T0LzU0n cAyGCAwz1hXbCcAZMwo3klrHdq+3DjMS2fH6qPOz7WgS3EH2CUJryIbMwFsRXHO4Nh qdwu1VWotxurFPISSIRejwjJiZQy678hdO60qGQN4AaWdJb0jUfWFKbbu0B7vmRubL LOvOJY7uJSGNw== Received: by mail-ed1-f70.google.com with SMTP id j9-20020a056402238900b004128085d906so4190154eda.19 for ; Sun, 27 Feb 2022 05:53:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x+DOMuEjhXppqlmSDNC0RKdzUzslcBqDhsGS9OsoQS4=; b=UyQ2/ZEFBIE1ygHSznuUM5fcsHOm0pdRscaSgF4xBl/pyWqTesYSByxFoSlQ0u7NWk LIcZipyTBUwVUe2Q7HyGxopNWC2Jx0GrZEQHgRNTdinCzYXH2BH54DIt9tobxXDMR2KL zEtSII3yeU+ClsyrazDqB9B2XMCykFkgTuHbq5V9DrwYgViPmklcWez3x16D64hn30Bl xzEd/nx8saErCNMvJY1DKHcwqBBxYidorgX6LU4Um9xa+zsUhftS/ClnsPjAN94YVlT8 hxvE5cjpcdNpywfCsc6n9F8HjhqKH+vSjSjKkPfvMjDFSamBAGexHMNf88IKf4yPuaSY SpDw== X-Gm-Message-State: AOAM531m86qECPjDF791y8INKDaCqC79ivPiO9RZABtV2FI4FxvP+BMK CLPPYCx3oqLr/EwZSYPa8FltNZSq9pXnRufGOxgizrO1S25SvIMgjIAHtKIdIk34ZiECgUIq/lu vAo2Gawu2TbHMB7X1NEVdGHu1xUyzlLpbhh+Sl8mL X-Received: by 2002:a17:906:354f:b0:6b4:1449:2d03 with SMTP id s15-20020a170906354f00b006b414492d03mr13078905eja.197.1645970019289; Sun, 27 Feb 2022 05:53:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLkm/ya1hWTxNWHY0owECzZBrknUNuVIsi2Y1TI9mIZSzwklvOz9AjjK7v7g0U5lSZuOzjqQ== X-Received: by 2002:a17:906:354f:b0:6b4:1449:2d03 with SMTP id s15-20020a170906354f00b006b414492d03mr13078900eja.197.1645970019102; Sun, 27 Feb 2022 05:53:39 -0800 (PST) Received: from localhost.localdomain (xdsl-188-155-181-108.adslplus.ch. [188.155.181.108]) by smtp.gmail.com with ESMTPSA id w11-20020a056402128b00b00412ec3f5f74sm4600760edv.62.2022.02.27.05.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 05:53:38 -0800 (PST) From: Krzysztof Kozlowski To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Stuart Yoder , Laurentiu Tudor , Abel Vesa , Shawn Guo , Sascha Hauer , Fabio Estevam , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Bjorn Helgaas , Bjorn Andersson , Mathieu Poirier , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Andy Gross , Srinivas Kandagatla , Mark Brown , "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, virtualization@lists.linux-foundation.org, Linus Torvalds Subject: [PATCH v3 09/11] clk: imx: scu: Fix kfree() of static memory on setting driver_override Date: Sun, 27 Feb 2022 14:53:27 +0100 Message-Id: <20220227135329.145862-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220227135214.145599-1-krzysztof.kozlowski@canonical.com> References: <20220227135214.145599-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 02 Mar 2022 09:33:34 +0100 Cc: Rasmus Villemoes , stable@vger.kernel.org, Krzysztof Kozlowski X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The driver_override field from platform driver should not be initialized from static memory (string literal) because the core later kfree() it, for example when driver_override is set via sysfs. Use dedicated helper to set driver_override properly. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Cc: Signed-off-by: Krzysztof Kozlowski --- drivers/clk/imx/clk-scu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 083da31dc3ea..4b2268b7d0d0 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -683,7 +683,12 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, return ERR_PTR(ret); } - pdev->driver_override = "imx-scu-clk"; + ret = driver_set_override(&pdev->dev, &pdev->driver_override, + "imx-scu-clk", strlen("imx-scu-clk")); + if (ret) { + platform_device_put(pdev); + return ERR_PTR(ret); + } ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id); if (ret)