mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
coresight: Handle errors in finding input/output ports
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: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5756949782
commit
fe470f5f7f
1 changed files with 5 additions and 2 deletions
|
@ -107,7 +107,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_name(&parent->dev), dev_name(&csdev->dev));
|
||||
|
||||
return 0;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int coresight_find_link_outport(struct coresight_device *csdev,
|
||||
|
@ -125,7 +125,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_name(&csdev->dev), dev_name(&child->dev));
|
||||
|
||||
return 0;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
|
||||
|
@ -178,6 +178,9 @@ static int coresight_enable_link(struct coresight_device *csdev,
|
|||
else
|
||||
refport = 0;
|
||||
|
||||
if (refport < 0)
|
||||
return refport;
|
||||
|
||||
if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
|
||||
if (link_ops(csdev)->enable) {
|
||||
ret = link_ops(csdev)->enable(csdev, inport, outport);
|
||||
|
|
Loading…
Reference in a new issue