[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201023021648.39214-1-jingxiangfeng@huawei.com>
Date: Fri, 23 Oct 2020 10:16:48 +0800
From: Jing Xiangfeng <jingxiangfeng@...wei.com>
To: <maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
<tzimmermann@...e.de>, <airlied@...ux.ie>, <daniel@...ll.ch>,
<sam@...nborg.org>, <andrzej.p@...labora.com>,
<a.hajda@...sung.com>, <narmstrong@...libre.com>
CC: <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<jingxiangfeng@...wei.com>
Subject: [PATCH] drm: Add the missed device_unregister() in drm_sysfs_connector_add()
drm_sysfs_connector_add() misses to call device_unregister() when
sysfs_create_link() fails to create. Add the missed function call
to fix it.
Fixes: e1a29c6c5955 ("drm: Add ddc link in sysfs created by drm_connector")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@...wei.com>
---
drivers/gpu/drm/drm_sysfs.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index f0336c804639..39e173e10cf7 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -274,6 +274,7 @@ static const struct attribute_group *connector_dev_groups[] = {
int drm_sysfs_connector_add(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
+ int ret = 0;
if (connector->kdev)
return 0;
@@ -291,10 +292,16 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
return PTR_ERR(connector->kdev);
}
- if (connector->ddc)
- return sysfs_create_link(&connector->kdev->kobj,
+ if (connector->ddc) {
+ ret = sysfs_create_link(&connector->kdev->kobj,
&connector->ddc->dev.kobj, "ddc");
- return 0;
+ if (ret) {
+ device_unregister(connector->kdev);
+ connector->kdev = NULL;
+ }
+ }
+
+ return ret;
}
void drm_sysfs_connector_remove(struct drm_connector *connector)
--
2.17.1
Powered by blists - more mailing lists