From: AngeloGioacchino Del Regno <kholk11@xxxxxxxxx> The calibrate_v1 function allocates the qfprom_cdata variable during qfprom_read, but it never gets freed: properly kfree it. Signed-off-by: AngeloGioacchino Del Regno <kholk11@xxxxxxxxx> --- drivers/thermal/qcom/tsens-v1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index 3c85a698123a..017501f37a41 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -173,8 +173,10 @@ static int calibrate_v1(struct tsens_priv *priv) int i; qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib"); - if (IS_ERR(qfprom_cdata)) + if (IS_ERR(qfprom_cdata)) { + kfree(qfprom_cdata); return PTR_ERR(qfprom_cdata); + } mode = (qfprom_cdata[4] & CAL_SEL_MASK) >> CAL_SEL_SHIFT; dev_dbg(priv->dev, "calibration mode is %d\n", mode); @@ -225,6 +227,7 @@ static int calibrate_v1(struct tsens_priv *priv) } compute_intercept_slope(priv, p1, p2, mode); + kfree(qfprom_cdata); return 0; } -- 2.21.0