Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934028AbcDFJrp (ORCPT ); Wed, 6 Apr 2016 05:47:45 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:11308 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933944AbcDFJrm (ORCPT ); Wed, 6 Apr 2016 05:47:42 -0400 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 06 Apr 2016 02:46:11 -0700 From: Wei Ni To: , , CC: , , , , , , , Wei Ni Subject: [PATCH] thermal: tegra: fix static checker warning Date: Wed, 6 Apr 2016 17:48:04 +0800 Message-ID: <1459936084-11875-1-git-send-email-wni@nvidia.com> X-Mailer: git-send-email 1.9.1 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 922 Lines: 30 There has a static checker warning: warn: variable dereferenced before check 'dev' (see line 222) Since check 'dev' is unnecessary, so remove this check. Fixes: ee6d79f202a4 ("thermal: tegra: add thermtrip function") Signed-off-by: Wei Ni Reported-by: Dan Carpenter --- drivers/thermal/tegra/soctherm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 559c74279eb8..d3cc8c99726f 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -223,10 +223,7 @@ static int thermtrip_program(struct device *dev, int temp; u32 r; - if (!dev || !sg) - return -EINVAL; - - if (!sg->thermtrip_threshold_mask) + if (!sg || !sg->thermtrip_threshold_mask) return -EINVAL; temp = enforce_temp_range(dev, trip_temp) / ts->soc->thresh_grain; -- 1.9.1