From patchwork Mon Oct 24 11:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654941wru; Mon, 24 Oct 2022 14:13:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66hxpUihiK90Xax5T7WMPv12VBvhTZMjOpUru2lsPgfJY+QaraHwiVH/vyl4r38/cHyhiD X-Received: by 2002:aa7:9a09:0:b0:562:64cc:94e0 with SMTP id w9-20020aa79a09000000b0056264cc94e0mr35188102pfj.60.1666646026622; Mon, 24 Oct 2022 14:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646026; cv=none; d=google.com; s=arc-20160816; b=U5S4W195UN9R2wby4yS+UxbW0CLNE5iH/j0zJa4gw6i3shNuHxr2aS+JMemxijXRTH 06l1uFrA6qnXMkgvi8HlTih/abZAY+vKZlM+lvQitVtsbLOeUPsVM1t5i9+XuIbR78y1 Yf+PGzuzQtgYMQQoUrX9U0vqHU3aaLDh9d5Fh3H/Q8SWQfqPs0YHcE6YIEHzkorKLRnm NjxL+jpqRrhQoFxs+eypWdnB4b1GcTH5ndjO3SN0trMwX9lvkulQGB6/TLwzQjvYOSVs 1kdVVm83KB90ihw72nqa4WqEm9nNvhvx22l0jpgLFbFahA0sVwMKKHteFFmdgZKU2S7l vt+A== 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=5A8WTLps5TI7lgV5aftwzc+9Sy4LidjYAS8v5d0BpGU=; b=oK0JqFoYsW0lpJzN2IZFWtAts8XiUUzhaCCeC7f4gF8XGoydctPk7Ky+91FbtnlsX8 YFlDF5YfSQS9+LIiNam/lcvOF3qHXxjMzlTzvpVhxE5Nnwb5L7mNR9EjGGW31fXQ27rf fHC2GrQfFCCM5zd6s0J+slRuCw2enTZxHERc5HDHq9hlxbTP1TEPtYfE4JQJ8OmE78zH 3EMPmU8DT2DyQZdTd38JFajl7QrObN+YA6s2ic+CeCE29VYA1rlqMaum4p28hvOIy4Yi Ci7c+x158eqJORmj/TvQ2oq4Eld05UlFEpVhlCPVjz87CJCKdcbtwdeayVFPtOnKaZAp lJzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rRlbPLl3; 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 190-20020a6300c7000000b0045fad1c30e6si558376pga.602.2022.10.24.14.13.32; Mon, 24 Oct 2022 14:13:46 -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=rRlbPLl3; 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 S231510AbiJXVMO (ORCPT + 99 others); Mon, 24 Oct 2022 17:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbiJXVLe (ORCPT ); Mon, 24 Oct 2022 17:11:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D98315FCA; Mon, 24 Oct 2022 12:17:54 -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 ams.source.kernel.org (Postfix) with ESMTPS id 8D502B811FB; Mon, 24 Oct 2022 11:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBEE8C433D6; Mon, 24 Oct 2022 11:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612722; bh=XfMKacPpJHtPyrtK6XCrrjpMb+UmbtczHbISfWsQXXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRlbPLl3mzKxwDFbzDqCBi++Wy/p0g8+gzzUzZvUxu7X2yDldGgMYL8PVdImdoPw1 FlDTCZIJEfiUYadXbiQes6BEEjriGkgWq0w4Rrex6vRcN6yeicJ9pI5P5i6GSkmEnY 3DgkI634OezbhmRo2U+74hALAmVuPOx7NWd3BZqA= 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.19 095/229] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024113002.116718205@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747605024139832282?= X-GMAIL-MSGID: =?utf-8?q?1747605024139832282?= 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 7ed8e510565e..c8c9daecd00d 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;