From patchwork Tue Oct 22 11:18:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 11204259 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1A421575 for ; Tue, 22 Oct 2019 11:18:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C08D220B7C for ; Tue, 22 Oct 2019 11:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730658AbfJVLSL (ORCPT ); Tue, 22 Oct 2019 07:18:11 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:37573 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbfJVLSL (ORCPT ); Tue, 22 Oct 2019 07:18:11 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iMsAw-0005V1-VM; Tue, 22 Oct 2019 11:18:07 +0000 From: Colin King To: Amit Kucheria , Andy Gross , Zhang Rui , Eduardo Valentin , Daniel Lezcano , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] thermal: qcom: tsens-v1: fix kfree of a non-pointer value Date: Tue, 22 Oct 2019 12:18:06 +0100 Message-Id: <20191022111806.23143-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Colin Ian King 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 --- drivers/thermal/qcom/tsens-v1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c index 2d1077b64887..bd2ddb684a45 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);