From patchwork Mon Nov 23 12:54:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7680911 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DAC59F54F for ; Mon, 23 Nov 2015 12:54:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2F5D20704 for ; Mon, 23 Nov 2015 12:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5E81206F9 for ; Mon, 23 Nov 2015 12:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751197AbbKWMyu (ORCPT ); Mon, 23 Nov 2015 07:54:50 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36064 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751173AbbKWMyu (ORCPT ); Mon, 23 Nov 2015 07:54:50 -0500 Received: by pacdm15 with SMTP id dm15so190612631pac.3; Mon, 23 Nov 2015 04:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qj1uitdgM7N5F5BfN6wsG8dRXiFO5Theus0jeXxcgYU=; b=W4hGMCy42r1rsNb/bjt/33IBEJeBtVGxO1AdeFRd99NIEbB6MY+0x/XPYgrMpc3z+W iiJIJiQWqBKbnL7NfIf5TMMKBn0A+W4r/tDgPjNGP6SZQMACpjn0XDoyH1Zb6TT4d8u/ LvhkF4LFf9B3jnpD6fAsk0HUh9CTgJChSkDTsFnjMFBKGo4Yhw7L+HEozHRojIbIG5I/ /npvAmoxqawsVDmUe3L1vfpnF6JAKy5y9IGRaRV2Jc2jioUt3V02Md/Bu4iSMbGVAENi pOZpMHE2YIY9fDeCJBNA+jYF+MyAQmOlUwrbDdCkW15RiuF1sLbXjM6HRcp5uYNJOjDa FVbg== X-Received: by 10.98.11.71 with SMTP id t68mr15962527pfi.82.1448283289641; Mon, 23 Nov 2015 04:54:49 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.181.80]) by smtp.gmail.com with ESMTPSA id mn6sm10380657pbc.83.2015.11.23.04.54.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 04:54:49 -0800 (PST) From: Sudip Mukherjee To: Eduardo Valentin , Zhang Rui Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] thermal: ti-soc-thermal: fix error check Date: Mon, 23 Nov 2015 18:24:41 +0530 Message-Id: <1448283281-21402-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We were only checking if data is not NULL but ti_bandgap_get_sensor_data() can return NULL or ERR_PTR. Signed-off-by: Sudip Mukherjee --- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index b213a12..d76bb7c 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -365,7 +365,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) data = ti_bandgap_get_sensor_data(bgp, id); - if (data && data->ti_thermal) { + if (!IS_ERR_OR_NULL(data) && data->ti_thermal) { if (data->our_zone) thermal_zone_device_unregister(data->ti_thermal); else