lkml.org 
[lkml]   [2018]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 4/4] thermal: tegra: fix coverity defect
Date
Fix dereference dev before null check.

Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/thermal/tegra/soctherm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index 3042837364e8..96527df91f2a 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -397,7 +397,7 @@ static int throttrip_program(struct device *dev,
struct soctherm_throt_cfg *stc,
int trip_temp)
{
- struct tegra_soctherm *ts = dev_get_drvdata(dev);
+ struct tegra_soctherm *ts;
int temp, cpu_throt, gpu_throt;
unsigned int throt;
u32 r, reg_off;
@@ -405,6 +405,8 @@ static int throttrip_program(struct device *dev,
if (!sg || !stc || !stc->init)
return -EINVAL;

+ ts = dev_get_drvdata(dev);
+
temp = enforce_temp_range(dev, trip_temp) / ts->soc->thresh_grain;

/* Hardcode LIGHT on LEVEL1 and HEAVY on LEVEL2 */
--
2.7.4
\
 
 \ /
  Last update: 2018-11-05 10:33    [W:0.135 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site