From: Colin Ian King Date: Tue, 22 Oct 2019 11:18:06 +0000 (+0100) Subject: thermal: qcom: tsens-v1: Fix kfree of a non-pointer value X-Git-Tag: v5.5-rc1~43^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7071f4914a40ae0027f4bc6d13f2a4eea7cab70;p=thirdparty%2Fkernel%2Flinux.git thermal: qcom: tsens-v1: Fix kfree of a non-pointer value Currently the kfree of pointer qfprom_cdata is kfreeing an error value that has been cast to a pointer rather than a valid address. Fix this by removing the kfree. Fixes: 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976") Signed-off-by: Colin Ian King Tested-by: AngeloGioacchino Del Regno Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20191022111806.23143-1-colin.king@canonical.com --- diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index 2d1077b648871..bd2ddb684a45d 100644 --- a/drivers/thermal/qcom/tsens-v1.c +++ b/drivers/thermal/qcom/tsens-v1.c @@ -240,10 +240,8 @@ static int calibrate_8976(struct tsens_priv *priv) u32 *qfprom_cdata; qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib"); - if (IS_ERR(qfprom_cdata)) { - kfree(qfprom_cdata); + if (IS_ERR(qfprom_cdata)) return PTR_ERR(qfprom_cdata); - } mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK); dev_dbg(priv->dev, "calibration mode is %d\n", mode);