Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp262658lqp; Mon, 10 Jun 2024 03:28:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6CPI4PdKlITl9jg8ZrWwxs9lNumCll+wHgUH8BId708Y6MTufSe3y7d5HxNMPPHiYxW6vlL0UBNASR7lrollPnEkdcYexI1T+0R0A2g== X-Google-Smtp-Source: AGHT+IFD/lSfEHDEdzWNTsA20MQIJ7gUSQLOc1v4PW4QhzUIQQNYrSN1//8/fwmQd7fvJ6+ff0oI X-Received: by 2002:a05:6a00:2e2a:b0:704:3b29:d041 with SMTP id d2e1a72fcca58-7043b2a29a5mr3189899b3a.0.1718015301067; Mon, 10 Jun 2024 03:28:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718015301; cv=pass; d=google.com; s=arc-20160816; b=UItZk2BTdP0UhH01TsEIk1pUt1KUG+4DoxmrrcL8POIFjBXCsB0YHt2qcBYKmuL4Op k2DBNpM3fEU/WjhgyV/BADjVuVV+k45fGM5aR8uxKRc2tC3+jTAihJghsxQXjJRzbShY afXpPP5PhqfaF4rJbaznzKRvKs7SiUCOe/b7g4Rm07Dw2vr3ckJIZAx9lTR80jjIMt62 B9HOoZiYFNexoqPGSi1wYSfs0kH6wvuKrqtAU3cS0nE4j03aXWgBlkDhxeSwtBlZKvie 3cZLWn2arfEXLcRJKXjUclGexbJ3nkgHhzGOoaXBwolQ1vzVRq9TUkPiSsBIFlTHV7JV lXrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=UGW1GGxzle7L9TpnG0ygLNifQaf3HC8I8IK780ubksw=; fh=lmxxjFeeiznSBG9jAIqfGBBnSWEtnENT2KTcfAjqhAg=; b=oavyGA49q0SVB1BoAqPtsAZLui0ibMJzv0AU2MoNZKvAOsBUXYdyaG+eGwYk9G8N1o AOP0EjMlvbAuE0S5cfQiJbpfzSnEnd8hsly++2E8s0rHDRj5pYsVsuVTMzYyd8AedwGX uuHHFGt6GxSRb+pUv4cIskIWvRrI+G2RLVsrS9lJg66ndBQdsnMpGEV29hn3cWH90azj ZIH0mWsDyq+8eBkBdD7BjWgbd/QvxcEWnZ3chlfTHeu6TNi5XiDUGELh8ybHqmuboBuL iyXxHkDUwsGwi0R0DjjH4GymZazdOtrzpzjbvHVamEgEAJOhG30iDPD76R2YPidOkp8s xnAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70423f52072si3993000b3a.281.2024.06.10.03.28.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 03:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208016-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7EEE8285930 for ; Mon, 10 Jun 2024 10:28:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78C7978C65; Mon, 10 Jun 2024 10:28:14 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EE3115B3 for ; Mon, 10 Jun 2024 10:28:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718015294; cv=none; b=Cfj0/bV4XVbTr9oY/jN7azaw+N4ZeOLa+NzU88L0dJY47K1gipRG1aFjAlEI6FI+KlPf8r8ptEL9N58CyC9nSgiGNT3Co4KD92xREVeoUvL5Ktec9mh/9pUU84Azo5+InWcG9pB9N3fQhgw7Vl/EeiGNopa4GljgmMvQSCBiLjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718015294; c=relaxed/simple; bh=59vqSNo8efv80hHanD7EjByevBNH4rkg7/y6UCfmSng=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nG8mODK/TUxOFHu2/FzI3MKjGZg35s/+0pyUGRisKs7nil6M8ExnMODn7+DvcRtNkdm7sm6rYNPYy+VqJDDLlvyCZPJJ5s/WkEsp2EUS153Waqo1EF367xD/mnTenWKwvhrSBzgpqXUn6o7yC5wGRai5RBhSZtFlpcDM9plCU3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1D43D1688; Mon, 10 Jun 2024 03:28:36 -0700 (PDT) Received: from e128090.cambridge.arm.com (unknown [10.1.198.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A54FC3F73B; Mon, 10 Jun 2024 03:28:09 -0700 (PDT) From: Adam Miotk To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Adam Miotk , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Smitha T Murthy , Deepak Pandey Subject: [PATCH] drm/bridge/panel: Fix runtime warning on panel bridge release Date: Mon, 10 Jun 2024 11:27:39 +0100 Message-Id: <20240610102739.139852-1-adam.miotk@arm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Device managed panel bridge wrappers are created by calling to drm_panel_bridge_add_typed() and registering a release handler for clean-up when the device gets unbound. Since the memory for this bridge is also managed and linked to the panel device, the release function should not try to free that memory. Moreover, the call to devm_kfree() inside drm_panel_bridge_remove() will fail in this case and emit a warning because the panel bridge resource is no longer on the device resources list (it has been removed from there before the call to release handlers). Signed-off-by: Adam Miotk --- drivers/gpu/drm/bridge/panel.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 32506524d9a2..fe5fb08c9fc4 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -360,9 +360,12 @@ EXPORT_SYMBOL(drm_panel_bridge_set_orientation); static void devm_drm_panel_bridge_release(struct device *dev, void *res) { - struct drm_bridge **bridge = res; + struct drm_bridge *bridge = *(struct drm_bridge **)res; - drm_panel_bridge_remove(*bridge); + if (!bridge) + return; + + drm_bridge_remove(bridge); } /** -- 2.25.1