linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@ti.com>
To: linux-pm@vger.kernel.org, rui.zhang@intel.com
Cc: linux-kernel@vger.kernel.org, Eduardo Valentin <eduardo.valentin@ti.com>
Subject: [PATCH 5/5] drivers: thermal: add check when unregistering cpu cooling
Date: Fri, 23 Aug 2013 18:03:16 -0400	[thread overview]
Message-ID: <1377295396-17289-6-git-send-email-eduardo.valentin@ti.com> (raw)
In-Reply-To: <1377295396-17289-1-git-send-email-eduardo.valentin@ti.com>

This patch avoids NULL pointer accesses while unregistering
cpu cooling devices, in case a NULL pointer is received.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
---
 drivers/thermal/cpu_cooling.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 82e15db..429a98c 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -496,8 +496,12 @@ EXPORT_SYMBOL_GPL(cpufreq_cooling_register);
  */
 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
 {
-	struct cpufreq_cooling_device *cpufreq_dev = cdev->devdata;
+	struct cpufreq_cooling_device *cpufreq_dev;
 
+	if (!cdev)
+		return;
+
+	cpufreq_dev = cdev->devdata;
 	mutex_lock(&cooling_cpufreq_lock);
 	cpufreq_dev_count--;
 
-- 
1.8.2.1.342.gfa7285d


      parent reply	other threads:[~2013-08-23 22:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 22:03 [PATCH 0/5] drivers: thermal: several fixes Eduardo Valentin
2013-08-23 22:03 ` [PATCH 1/5] thermal: hwmon: move hwmon support to single file Eduardo Valentin
2013-08-23 22:03 ` [PATCH 2/5] drivers: thermal: parent virtual hwmon with thermal zone Eduardo Valentin
2013-08-23 22:03 ` [PATCH 3/5] drivers: thermal: make usage of CONFIG_THERMAL_HWMON optional Eduardo Valentin
2013-08-23 23:08   ` Rafael J. Wysocki
2013-08-27 18:26     ` Eduardo Valentin
2013-08-27 21:17       ` Rafael J. Wysocki
2013-08-28  0:13         ` Zhang Rui
2013-08-28 13:15           ` Eduardo Valentin
2013-08-29 20:12           ` [PATCHv2 " Eduardo Valentin
2013-09-02 14:09             ` Eduardo Valentin
2013-08-23 22:03 ` [PATCH 4/5] thermal: thermal_core: allow binding with limits on bind_params Eduardo Valentin
2013-08-23 22:03 ` Eduardo Valentin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377295396-17289-6-git-send-email-eduardo.valentin@ti.com \
    --to=eduardo.valentin@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).