From patchwork Mon Oct 24 11:30:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401287wru; Mon, 24 Oct 2022 04:48:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7umwaxxBorfTaILnF95b1YyrWSjXd5VVgOSqZyEDZ98guAZMtQfXiBtF35Z5uPmAde5mHu X-Received: by 2002:a17:907:94c3:b0:78e:2866:f89f with SMTP id dn3-20020a17090794c300b0078e2866f89fmr26591051ejc.617.1666612104916; Mon, 24 Oct 2022 04:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612104; cv=none; d=google.com; s=arc-20160816; b=r3hvg0ZgVv9Se4Pfle91PbkmmogaiGAus+Gq7iwUSPFf0pKRHy1HqIBrn2SQhNXP4B t38rnC7iE+PCkTEBrLtwa2u45og/vbJfUoUyPB33bZsRZTsQOZH9EgAx6tB3lM/NsiBV GEbMAxtBIpvd3cLCvM7oFxHgvm2+xsCyiUhueNFH8QYl4m3jL+nczQXTdT0Y5q/xZht1 5dmRUTjfJXCLba0wNMvMCbI1Z07VzjkDY3k8hxtyW8gCirjXyRBC984NhYBjDPYR3sCE g2y+7N9EOi7Nbfds+wUUttjK+p0wqsiOyyruUegJnbzW3u1osqQVhWWvUtnzahSZPWM3 EVLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+F7npxiqhbpybcmHRqSAkOpBDwU/ymBdhoHhCjG2ma0=; b=BulapTnQR/FwSm0b4Ab318FhkHsOr6CXPuvy61v8fAxtfAHS3plINShQulTBXU/142 LHuDxkXwQVTxTiKKghqQaYRvz5MYmUZK4RtgrwckP2EyMphBe0evHglXXg4YmcPXzstr MhGcgKI/Bwxu4pANPI9IJNiFkqdGf+yHpOdibUdKDglTLoM3qUV1zasUmnS6oCIXYnW+ L9i4mChiI5yqCCg9M6A5zsJhDummGTwXtRpxsyC9smt+FpjdHo+Er6F5ZOuP0QMGlFTb PAIT2pwpV08qgF788JirpIJiKjKnYFzCU8mn0pQaAcTOoIAf7oFuoiQ6/M10GyoyBwN4 IHNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bl5D71Ml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a05640234d000b00459c73bd1c6si31128587edc.550.2022.10.24.04.48.01; Mon, 24 Oct 2022 04:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bl5D71Ml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231690AbiJXLrY (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbiJXLpn (ORCPT ); Mon, 24 Oct 2022 07:45:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BF31B1DC; Mon, 24 Oct 2022 04:42:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A100B612A0; Mon, 24 Oct 2022 11:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D51C433D6; Mon, 24 Oct 2022 11:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611700; bh=HO5/Zmu9y+TNgQd34E0TWbyRFfogGohcSa82D9Hg1QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bl5D71MlfOFf7/rNhLAlqccCSFIfBy6wngI2QJYMITGH6Eg4qwyX27hp0q8k8uzIO fZD2q042Kekhzjnh20Cbb5lTOQ0+gCnS6e9rISbXslECANZY4fo7Yt5nQzSQOiyY88 5agPgUFxxQyvdRKHDGo2fSXD2jBJ6hyM6zsVmuzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Maxime Ripard , Sasha Levin Subject: [PATCH 4.9 077/159] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024112952.247642767@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569454379135359?= X-GMAIL-MSGID: =?utf-8?q?1747569454379135359?= From: Maxime Ripard [ Upstream commit 668a8f17b5290d04ef7343636a5588a0692731a1 ] Whenever the MIPI-DSI host is unregistered, the code of mipi_dsi_host_unregister() loops over every device currently found on that bus and will unregister it. However, it doesn't detach it from the bus first, which leads to all kind of resource leaks if the host wants to perform some clean up whenever a device is detached. Fixes: 068a00233969 ("drm: Add MIPI DSI bus support") Acked-by: Thomas Zimmermann Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220711173939.1132294-2-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 99415808e9f9..af80cf8030b8 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -305,6 +305,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + mipi_dsi_detach(dsi); mipi_dsi_device_unregister(dsi); return 0;