coresight: tmc: etf: Free its buffer and set NULL when etf can't be enabled
In function tmc_enable_etf_sink_sysfs, the local variable buf was allocated and assigned to drvdata->buffer, and buf will be freed because etf can't be enabled, but drvdata->buffer still point to the address. So in function tmc_read_unprepare_etb, beacause drvdata->mode is CS_MODE_DISABLED, local variable buf was assigned by drvdata->buf and free again. Change-Id: I7d25e7db0a983fc134e8d8dfb954936233f0d167 Signed-off-by: yingdeng <quic_yingdeng@quicinc.com>
This commit is contained in:
parent
9cfdeb74ee
commit
8a01c3ed0f
@ -247,7 +247,8 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
|
||||
atomic_inc(csdev->refcnt);
|
||||
} else {
|
||||
/* Free up the buffer if we failed to enable */
|
||||
used = false;
|
||||
kfree(drvdata->buf);
|
||||
drvdata->buf = NULL;
|
||||
}
|
||||
out:
|
||||
spin_unlock_irqrestore(&drvdata->spinlock, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user