Skip to content

Commit 7a46541

Browse files
Suzuki K Poulosegregkh
authored andcommitted
coresight: Handle errors in finding input/output ports
[ Upstream commit fe470f5 ] 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e593232 commit 7a46541

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/hwtracing/coresight/coresight.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int coresight_find_link_inport(struct coresight_device *csdev,
115115
dev_err(&csdev->dev, "couldn't find inport, parent: %s, child: %s\n",
116116
dev_name(&parent->dev), dev_name(&csdev->dev));
117117

118-
return 0;
118+
return -ENODEV;
119119
}
120120

121121
static int coresight_find_link_outport(struct coresight_device *csdev,
@@ -133,7 +133,7 @@ static int coresight_find_link_outport(struct coresight_device *csdev,
133133
dev_err(&csdev->dev, "couldn't find outport, parent: %s, child: %s\n",
134134
dev_name(&csdev->dev), dev_name(&child->dev));
135135

136-
return 0;
136+
return -ENODEV;
137137
}
138138

139139
static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
@@ -186,6 +186,9 @@ static int coresight_enable_link(struct coresight_device *csdev,
186186
else
187187
refport = 0;
188188

189+
if (refport < 0)
190+
return refport;
191+
189192
if (atomic_inc_return(&csdev->refcnt[refport]) == 1) {
190193
if (link_ops(csdev)->enable) {
191194
ret = link_ops(csdev)->enable(csdev, inport, outport);

0 commit comments

Comments
 (0)