From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8F1B248176 for ; Fri, 2 Jan 2026 15:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767369490; cv=none; b=D/zZfS9sYNh2lRYc6SQYWPs7zrhwzhRkY1hZ5iwH3f8CW+TkrJSBY9HQUez/fnekU1y70GMloyVmSxTh2f4FJQ10h8VQoGmANLhPDHiudQkjlyaiJ6+0dTQzOji6SrQ7rbYdLyBSiW7KhNkDFJf1kGhCzvI99i6Ykwg7y+Yi/Sw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767369490; c=relaxed/simple; bh=0GPnhNFc0YWpsBTS4CUTOCT6To4nN87v0lhpU9nZzy4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=StcSl1MtlimlCwzV6hUQwK5+GPj9jLGNbaDsq9x7GkdNSj3pBSTFhvrQkj4weP629cWGO8V5n6Kr/GYExmJsSP+9PkLE3J5BD9k/pr3JvOVjJgLoFMvFAa1rzDjapK/5TajO+OlCWTinNjs7V6s3ZbHs8v3MNw9L4Tp4ZWu1t/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LhJ3LPHB; arc=none smtp.client-ip=209.85.218.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LhJ3LPHB" Received: by mail-ej1-f65.google.com with SMTP id a640c23a62f3a-b728a43e410so2337321266b.1 for ; Fri, 02 Jan 2026 07:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767369487; x=1767974287; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=inEjkYpZZFKseUFbKo7AFRhLn8xe1tV4AKOq/ebShUM=; b=LhJ3LPHBV0czB4kIzT6lR4+gGLAxsGS9DtBriuZ6DB/zp3IU5wCKKWfbTKCH51VblH iUu6RoKafMoE8MGv+42sFQlZAr4LTvAvgyjPPkNziWe70Aq8Si0SfxiO8oasTp47WvMz X76DEo3ed/21CRZtGztNZDMBXmrujRx08fa6H6eGEXFaxLsxb5chQAzhs+zGRlNd/6Zv MkOkAYk/vCm31y0Jeoa4KHmyJE2b6T1s66V8KUhHEs1FJpqe1K7cAV4S6UpWj46V1y73 z4RHb8Ug8DEpqpa3feamWjA9/sDKNcfuznvq3VM6SL3SK/H9ScAZO/K75yafy0hJg62C OI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767369487; x=1767974287; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=inEjkYpZZFKseUFbKo7AFRhLn8xe1tV4AKOq/ebShUM=; b=nt8gAjt9zHUMeA1ftXa0gIuyXJWi7NxBo4I8JIRS1nnJBh4kk518PFvUfvGVXpnbiL rbmB3mgR2G9WG8x0U9OIEjB//UJMay+2+exzug4eOYSCYEBY0A3KfnR3AK3AgGq/XUsI GmdS6gTt99JjNDLHFkSzOGaVQwZqX7Ud3d2lLVb4mmNHANGdKzNDg6Thph5DFMtYdIcF aF1jn/4Jhq3WdHbyBgOF483WtLbFFphh6QYw8NFbMKSZaDOZ2f+GG6myHUq1ffrlrd+H 6TrAirioo3TZu/RkJj3xHln3pS5L/KD5dQmtIJbB7exS3kNAzTofPOr7acacBfDF3wKX CIuA== X-Forwarded-Encrypted: i=1; AJvYcCVi6bEFBtRuU4FxQVo7RN2H7/oI4o/h93DAwMATjiUFx7XcTdwjZEAITadSKqlweL4FPsqiObwYbuG8FAI=@vger.kernel.org X-Gm-Message-State: AOJu0Ywjq2Cg5lAN8kVwxL5pnGe89CBjET428WlTVFXIO+4xyJ0ebcTL R89lbqyF3BAVCmYw8Vh1zFpyuQD6JTcJyAWOmL/k7n6ektJSZv49+UUj X-Gm-Gg: AY/fxX4YKoR+j1bJ1krqMNNe32IfQEN0ZDX4/8N8WBxQ4uZTVa8e7oU6rPJTcc5FqUB BMts4plF3o1EJ1hJbip+6FcAeUQWqwI+FB7O3hkxKAigkGGVRMKvDGM6UvuBmFc6E1hJbRypoM5 Y4pmAvgEMeqwkcbpHQn/zhc9saJiiauYnQBCXJu8RawheWO7d97A9B2OuSYq68oWmoityQwIlFS suiO+OnsvySC6+FLiX6NYlkvLbgeHYKoexBJWBs3m+WHu2gzjRlQVxUvBhYdkKD5c/atyrmlR63 +/6FYEG42Dk/oMattEP2BltQFskkztDKLedg+PrZ4/94HHZb/+6paliW7H82H/qAOcgGygbfNxR cI+NmAQetpqfJQ6i8siexBSk2rzIkL5lshphmMYxvRg85V4x2j6Qzes/oFGg8Q98qf31UZylPRo epOomvEq3sBkor X-Google-Smtp-Source: AGHT+IHiO3O4EGawpFCvkJsZU4HHFVkQUvnh0vx9UvoieKlX+GabYma9+cfOIH50Ic7AgiFfru4A+w== X-Received: by 2002:a17:907:3fa5:b0:b75:7b39:90c9 with SMTP id a640c23a62f3a-b803718390fmr4882816666b.51.1767369486868; Fri, 02 Jan 2026 07:58:06 -0800 (PST) Received: from osama ([2a02:908:1b4:dac0:ac54:a680:a017:734f]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8056ff4925sm4098474566b.31.2026.01.02.07.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jan 2026 07:58:06 -0800 (PST) Date: Fri, 2 Jan 2026 16:58:04 +0100 From: Osama Abdelkader To: Luca Ceresoli Cc: Andy Yan , stable@vger.kernel.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dmitry Baryshkov , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drm/bridge: synopsys: dw-dp: return when attach bridge fail Message-ID: References: <20251231144115.65968-1-osama.abdelkader@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 02, 2026 at 11:46:08AM +0100, Luca Ceresoli wrote: > Hello Osama, Andy Yan, > > Andy, a question for you below. > > On Wed Dec 31, 2025 at 3:41 PM CET, Osama Abdelkader wrote: > > When drm_bridge_attach() fails, the function should return an error > > instead of continuing execution. > > > > Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support library") > > Cc: stable@vger.kernel.org > > > > Signed-off-by: Osama Abdelkader > > --- > > v2: > > use concise error message > > add Fixes and Cc tags > > --- > > drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c > > index 82aaf74e1bc0..bc311a596dff 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c > > @@ -2063,7 +2063,7 @@ struct dw_dp *dw_dp_bind(struct device *dev, struct drm_encoder *encoder, > > > > ret = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); > > if (ret) > > - dev_err_probe(dev, ret, "Failed to attach bridge\n"); > > + return ERR_PTR(dev_err_probe(dev, ret, "Failed to attach bridge\n")); > > Your change looks good now. However there is aanother issue, sorry for not > having noticed before. > > While reading the dw_dp_bind() code in its entirety I have noticed that on > any error after drm_bridge_attach() (and also a drm_bridge_attach() error, > with this patch) it returns without undoing the previous actions. This is > fine for devm actions, but a problem for non-devm actions, which start at > drm_dp_aux_register(). > > For example, if phy_init() fails, dw_dp_bind() returns without calling > drm_dp_aux_unregister(), thus leaking the resources previously allocated by > drm_dp_aux_register(). > > Andy, can you tell whether my analysis is correct? > > If it is, this should be fixed before applying this patch. Osama, do you > think you can add such a patch in your next iteration? Thanks Luca for the review, I just sent v3. Best regards, Osama > > Best regards, > Luca > > -- > Luca Ceresoli, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com