From: Mathieu Poirier Date: Wed, 9 May 2018 18:06:05 +0000 (-0600) Subject: coresight tmc etr: Make memory check consistent in the same function X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3606a1dcb46eee173203702b6b19cd898afa5d15;p=linux.git coresight tmc etr: Make memory check consistent in the same function While operating from sysFS the TMC-ETR driver needs to make sure it has memory to work with but doesn't allocate memory uselessly either. Since the main memory handle for this driver is drvdata::vaddr, use it throughout function tmc_enable_etr_sink_sysfs() so that things are consistent. Reported-by: Dan Carpenter Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index cce2ff42e8e2c..8ee8c66f40021 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -153,11 +153,11 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) goto out; /* - * If drvdata::buf == NULL, use the memory allocated above. + * If drvdata::vaddr == NULL, use the memory allocated above. * Otherwise a buffer still exists from a previous session, so * simply use that. */ - if (drvdata->buf == NULL) { + if (drvdata->vaddr == NULL) { used = true; drvdata->vaddr = vaddr; drvdata->paddr = paddr;