From patchwork Wed Mar 16 15:08:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 12782841 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 D4C9DC433F5 for ; Wed, 16 Mar 2022 15:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3xeOjl4Pbw5+Se48Pun57/Ln3Suqe4zg5Hejo2GY2qc=; b=jx1NF5BynLvGNu OET57hwr0ne473+p+XHVAzsY9AuJyURE9ac/6QBIU3L0ikCN2wT5lpleSQCBiQaGfrlYNGRUqlzf4 y+avEIt/mvcG7o9a/DvJOD/DSkjRILKt5BYUnCbHvkKgiXKe846vSgHSWYZx7U+jei+aaNlTio4HI vDfXFfShzs0ZPOI+qYd/gns3eGcTBlBak/T8n18TZk8dhft/0c+hNfA1Coq5EVCY+NGCfP4ucLH8O kfiw4hIT64a+8aedcPJmiYqLf5f+z8xnaWoQLKTgBki8B44IjuaPfs0zEX+TUqITHGRfLgN1OwifT b3RDlxs0mhWTZnErJHvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUVJ6-00DRQh-Dm; Wed, 16 Mar 2022 15:11:25 +0000 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUVGz-00DQGN-BU for linux-arm-kernel@lists.infradead.org; Wed, 16 Mar 2022 15:09:14 +0000 Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) (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 122D43F798 for ; Wed, 16 Mar 2022 15:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1647443352; bh=0TkaUHsdiaalOGmdOdYbrrLuoBcQ76N1kyxAw52pHyQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jyHht3XCLNr8VV2B/uTpzBkSInAMbmI/OgaxwuNmMa3xzDLPvAgITmvgRbvbAXnCa CaP/7VEhfYJWX+DtRZdBZ64KUBKWE1vAwJSWpqXxFXw6lFdFjmd3CCKEZ3UUQ7mAqG LphkR5ZMxUp3ep/FzIqHqol6T1yalNIFlqJzB0xMos5H70hWwhe5VgAYXG8ATxB5w2 o/vzY7Z3+bIQwQGI5Yer4V1vNAurqUcNpUCQqXpFYgbJpK1GhBM75dch+CId9Pr79a yopE++kbJngLbpOU/WNUH+pXUOwW8f1PAGwzsWGLd2vIw9d8IeX1cs9hWy/1Yza19r zu3mbXUZ8FsHQ== Received: by mail-lj1-f197.google.com with SMTP id x3-20020a05651c104300b00247ebe980b7so1025340ljm.11 for ; Wed, 16 Mar 2022 08:09:12 -0700 (PDT) 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=0TkaUHsdiaalOGmdOdYbrrLuoBcQ76N1kyxAw52pHyQ=; b=0i+pkGDqMRs2f1ywc/xUVe1QVPxVW8DUsz8ZvenxDN7HpsL6tmOlMXB6sqE6iZhbLB QfEF2mNGrBSUyumKGzK1bzchgxNLFG56D1rkrQWCA65xubuD76N4SKW9whg1CV/1N0ZW vLZcErMZlcPatnAeraAIyM5PeQ6pgZHpyGTXc7hkdO73tMQROBPvkw3pg3ewwBq14Rsh WrrTBm+uuWN92aXCOgc560xtpWIt1y9b2Dg7Xkd5H5m8Yh650B4ibk9oSJ9kkKD3N28/ V/2YVOExuq/ljB9TxX9ynxJEQpsoicsnPEYv4bO5iz9PIzY6CIAhbnRf2tOhPlItDJwR RzGQ== X-Gm-Message-State: AOAM532fQnVwAdq2Eg56blvaKguZQiU4N+MM29fGpRl7QLn2Xa6OF3AO i8d9XYmoq+KrlYd1UjOCWSOvJowlQwCY85fNShWPEfRT7VpCMyLJ28SNSqjyGrHdzbw4jL4arpV 7o+qRuL+AgDoBuM7qIbNuXwYVLIOrjmdrT41oFMy2DMnYDaIFsVwZ X-Received: by 2002:a5d:6442:0:b0:203:dff2:866c with SMTP id d2-20020a5d6442000000b00203dff2866cmr272607wrw.465.1647443340523; Wed, 16 Mar 2022 08:09:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnOg2aSuuzk/AN13SVnFGjUvC/KtTXL980cTeRfOeIj0D4M/X0M0ZN717fC4+xLvcCtZ4GNg== X-Received: by 2002:a5d:6442:0:b0:203:dff2:866c with SMTP id d2-20020a5d6442000000b00203dff2866cmr272574wrw.465.1647443340291; Wed, 16 Mar 2022 08:09:00 -0700 (PDT) Received: from localhost.localdomain (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id u18-20020adfdd52000000b001f04e9f215fsm1895105wrm.53.2022.03.16.08.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 08:08:59 -0700 (PDT) From: Krzysztof Kozlowski To: Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Stuart Yoder , "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 , 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 , Rasmus Villemoes , Andy Shevchenko , Krzysztof Kozlowski , stable@vger.kernel.org, Stephen Boyd Subject: [PATCH v5 09/11] clk: imx: scu: Fix kfree() of static memory on setting driver_override Date: Wed, 16 Mar 2022 16:08:01 +0100 Message-Id: <20220316150803.421897-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220316150533.421349-1-krzysztof.kozlowski@canonical.com> References: <20220316150533.421349-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220316_080913_582123_6DF9AB8C X-CRM114-Status: GOOD ( 13.94 ) 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 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 Acked-by: Stephen Boyd --- 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)