CHROMIUM: drm/rockchip: cdn-dp: resolve sysfs warning

I've seen this:

  sysfs: cannot create duplicate filename '/devices/platform/fec00000.dp/hdcp_key'

Presumably because component_add() can -EPROBE_DEFER.

At any rate, we shouldn't leave the sysfs file hanging around. Clean it
up on probe failure, and on removal.

BUG=b:36566733
TEST=boot

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/458836
Reviewed-by: Guenter Roeck <groeck@chromium.org>

Change-Id: Ic10f45c0d67cfcc41ab89af108a78f641f424872
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
Brian Norris
2017-03-23 14:17:23 -07:00
committed by Tao Huang
parent 6f4dea14e1
commit f65bdbbfcc

View File

@@ -1502,7 +1502,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
struct cdn_dp_device *dp;
struct extcon_dev *extcon;
struct phy *phy;
int i;
int ret, i;
dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
if (!dp)
@@ -1542,9 +1542,19 @@ static int cdn_dp_probe(struct platform_device *pdev)
mutex_init(&dp->lock);
dev_set_drvdata(dev, dp);
device_create_file(dev, &dev_attr_hdcp_key);
ret = device_create_file(dev, &dev_attr_hdcp_key);
if (ret)
return ret;
return component_add(dev, &cdn_dp_component_ops);
ret = component_add(dev, &cdn_dp_component_ops);
if (ret)
goto err;
return 0;
err:
device_remove_file(dev, &dev_attr_hdcp_key);
return ret;
}
static int cdn_dp_remove(struct platform_device *pdev)
@@ -1553,6 +1563,7 @@ static int cdn_dp_remove(struct platform_device *pdev)
cdn_dp_suspend(dp->dev);
component_del(&pdev->dev, &cdn_dp_component_ops);
device_remove_file(&pdev->dev, &dev_attr_hdcp_key);
return 0;
}