From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Poirier Subject: Re: [PATCH 06/20] coresight: Handle errors in finding input/output ports Date: Fri, 8 Jun 2018 14:24:28 -0600 Message-ID: <20180608202428.GE30587@xps15> References: <1528235011-30691-1-git-send-email-suzuki.poulose@arm.com> <1528235011-30691-7-git-send-email-suzuki.poulose@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1528235011-30691-7-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, robh@kernel.org, frowand.list@gmail.com, mark.rutland@arm.com, sudeep.holla@arm.com, arm@kernel.org, linux-kernel@vger.kernel.org, matt.sealey@arm.com, john.horley@arm.com, charles.garcia-tobin@arm.com, coresight@lists.linaro.org, devicetree@vger.kernel.org, mike.leach@linaro.org List-Id: devicetree@vger.kernel.org On Tue, Jun 05, 2018 at 10:43:17PM +0100, Suzuki K Poulose wrote: > 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 > Signed-off-by: Suzuki K Poulose > --- > drivers/hwtracing/coresight/coresight.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index 69e9136..3c1c058 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -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); Queued for the next rc - no need to resend. Thanks, Mathieu > -- > 2.7.4 >