Commit 8d6f7e9d authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Kleber Sacilotto de Souza

coresight: Handle errors in finding input/output ports

BugLink: https://bugs.launchpad.net/bugs/1798587

[ Upstream commit fe470f5f ]

If we fail to find the input / output port for a LINK component
while enabling a path, we should fail gracefully rather than
assuming port "0".

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 0b5e034d
...@@ -86,7 +86,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev) ...@@ -86,7 +86,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev)
dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n", dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n",
dev_name(&parent->dev), dev_name(&csdev->dev)); dev_name(&parent->dev), dev_name(&csdev->dev));
return 0; return -ENODEV;
} }
static int coresight_find_link_outport(struct coresight_device *csdev) static int coresight_find_link_outport(struct coresight_device *csdev)
...@@ -107,7 +107,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev) ...@@ -107,7 +107,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev)
dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n", dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n",
dev_name(&csdev->dev), dev_name(&child->dev)); dev_name(&csdev->dev), dev_name(&child->dev));
return 0; return -ENODEV;
} }
static int coresight_enable_sink(struct coresight_device *csdev) static int coresight_enable_sink(struct coresight_device *csdev)
...@@ -155,6 +155,9 @@ static int coresight_enable_link(struct coresight_device *csdev) ...@@ -155,6 +155,9 @@ static int coresight_enable_link(struct coresight_device *csdev)
else else
refport = 0; refport = 0;
if (refport < 0)
return refport;
if (atomic_inc_return(&csdev->refcnt[refport]) == 1) { if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
if (link_ops(csdev)->enable) { if (link_ops(csdev)->enable) {
ret = link_ops(csdev)->enable(csdev, inport, outport); ret = link_ops(csdev)->enable(csdev, inport, outport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment