{"id":808479,"url":"http://patchwork.ozlabs.org/api/1.2/patches/808479/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/patch/1504223549-4152-1-git-send-email-nicoleotsuka@gmail.com/","project":{"id":21,"url":"http://patchwork.ozlabs.org/api/1.2/projects/21/?format=json","name":"Linux Tegra Development","link_name":"linux-tegra","list_id":"linux-tegra.vger.kernel.org","list_email":"linux-tegra@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504223549-4152-1-git-send-email-nicoleotsuka@gmail.com>","list_archive_url":null,"date":"2017-08-31T23:52:29","name":"thermal: tegra: dereference the pointer after null check","commit_ref":null,"pull_url":null,"state":"deferred","archived":false,"hash":"1de61c30f7e368f209d258c7389f9cee1c05824f","submitter":{"id":36301,"url":"http://patchwork.ozlabs.org/api/1.2/people/36301/?format=json","name":"Nicolin Chen","email":"nicoleotsuka@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-tegra/patch/1504223549-4152-1-git-send-email-nicoleotsuka@gmail.com/mbox/","series":[{"id":928,"url":"http://patchwork.ozlabs.org/api/1.2/series/928/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/list/?series=928","date":"2017-08-31T23:52:29","name":"thermal: tegra: dereference the pointer after null check","version":1,"mbox":"http://patchwork.ozlabs.org/series/928/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808479/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808479/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-tegra-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-tegra-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"TR68eTKA\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjzgw60zQz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 09:52:28 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751870AbdHaXwP (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 31 Aug 2017 19:52:15 -0400","from mail-pg0-f67.google.com ([74.125.83.67]:35636 \"EHLO\n\tmail-pg0-f67.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751307AbdHaXwM (ORCPT\n\t<rfc822;linux-tegra@vger.kernel.org>);\n\tThu, 31 Aug 2017 19:52:12 -0400","by mail-pg0-f67.google.com with SMTP id r133so683612pgr.2;\n\tThu, 31 Aug 2017 16:52:12 -0700 (PDT)","from Asurada-Nvidia.nvidia.com (searspoint.nvidia.com.\n\t[216.228.112.21]) by smtp.gmail.com with ESMTPSA id\n\td6sm859590pfh.113.2017.08.31.16.52.10\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 31 Aug 2017 16:52:11 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=23R2Yv9L3fMcREVQh9++7GnKelUv94JdPgfMYrt+mYI=;\n\tb=TR68eTKA/7rNy68HWD3AQ/lOxN9VV2blkxzcEgEGd/DhSqKI8zkSkNeUrIidGrMPuV\n\thNNVWqYQgtj/Tmpi2zFMKNxc9WRbPn/oEuDXbfdnkI/EiIiUNVOTm9Xeg90DmKdWVtTf\n\tEODxIqSy32SH5nKgScZwq2reiPDRKirkYu+NEwGhlK2tTh7M4w7MbRStR+btkdsSUeEk\n\tc7yxdRz23nh6Uvd6VF8xnhY3rXXO4N7chaAZWQRaMoEzf7KDGTfQIvsxLZZ4WHsFCI60\n\tYBxeBThAwxmgDc3kLpuaCqASQfizYlVRWOxTlobXKgwm9sYSKR4HOHUY8hq0bPbsCfpQ\n\tI9RA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=23R2Yv9L3fMcREVQh9++7GnKelUv94JdPgfMYrt+mYI=;\n\tb=HIDKJl8uujTfeFuTCj6DJcOUkYVCHtBGTjHuNv0uDnhN/sHhHuJi0dkaL39ddcZ6cx\n\tHxsL4tacrhrKWl/bN8SRpXiLcd5p1VylO6WOhnb8OQtpthtQ/Dhr1xQ+nC0fTxgC6hlP\n\tycTm+j6h81js2IZPHEDBzWlN6ilisObDUdAVa7J2OFdgMI2MFTT908rS/1vkoGLeBPQV\n\tHMEy1Up3xH3Nz3cyYRrOWjqVtIDhjcLl0NgwOjhE4Adb7aaSIrfDOoox5e+w2Cy0sNCh\n\tQiqymWud0j9ajuvJTitH9uipjoL4p+eqclNfkgb9kkw5e6CVZiz2KajjeuHq6UeRNk2y\n\thSaw==","X-Gm-Message-State":"AHPjjUhx99E0QumF/p5a94VPaYs/GY0TzxCUFCDByZhoPhV0MdQsWN1B\n\tjUaD087hzXn7aw==","X-Google-Smtp-Source":"ADKCNb5s44fU1V55unlCHibGowbwfZsUAUCG+mRrzFm6k28avFwW9Q21VZaSw2pk3RYhVY4V/kQksw==","X-Received":"by 10.98.58.78 with SMTP id h75mr172023pfa.115.1504223531837;\n\tThu, 31 Aug 2017 16:52:11 -0700 (PDT)","From":"Nicolin Chen <nicoleotsuka@gmail.com>","To":"rui.zhang@intel.com","Cc":"edubezval@gmail.com, thierry.reding@gmail.com,\n\tjonathanh@nvidia.com, wni@nvidia.com, linux-pm@vger.kernel.org,\n\tlinux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tsrikars@nvidia.com","Subject":"[PATCH] thermal: tegra: dereference the pointer after null check","Date":"Thu, 31 Aug 2017 16:52:29 -0700","Message-Id":"<1504223549-4152-1-git-send-email-nicoleotsuka@gmail.com>","X-Mailer":"git-send-email 2.1.4","Sender":"linux-tegra-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-tegra.vger.kernel.org>","X-Mailing-List":"linux-tegra@vger.kernel.org"},"content":"The dev pointer is going through a null check after a dereference.\nSo this patch just reverses that.\n\nSigned-off-by: Nicolin Chen <nicoleotsuka@gmail.com>\n---\n drivers/thermal/tegra/soctherm.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c\nindex 7d2db23..6718799 100644\n--- a/drivers/thermal/tegra/soctherm.c\n+++ b/drivers/thermal/tegra/soctherm.c\n@@ -478,7 +478,7 @@ static int throttrip_program(struct device *dev,\n \t\t\t     struct soctherm_throt_cfg *stc,\n \t\t\t     int trip_temp)\n {\n-\tstruct tegra_soctherm *ts = dev_get_drvdata(dev);\n+\tstruct tegra_soctherm *ts;\n \tint temp, cpu_throt, gpu_throt;\n \tunsigned int throt;\n \tu32 r, reg_off;\n@@ -486,6 +486,8 @@ static int throttrip_program(struct device *dev,\n \tif (!dev || !sg || !stc || !stc->init)\n \t\treturn -EINVAL;\n \n+\tts = dev_get_drvdata(dev);\n+\n \ttemp = enforce_temp_range(dev, trip_temp) / ts->soc->thresh_grain;\n \n \t/* Hardcode LIGHT on LEVEL1 and HEAVY on LEVEL2 */\n","prefixes":[]}