LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch 6/6] Intel Menlow : extract return values using PTR_ERR
@ 2008-02-15  5:25 Thomas, Sujith
  0 siblings, 0 replies; only message in thread
From: Thomas, Sujith @ 2008-02-15  5:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lenb, mingo, linux-acpi, linux-kernel, linux-pm, Zhang, Rui

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.

Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
---

 drivers/misc/intel_menlow.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Index: linux-2.6.24/drivers/misc/intel_menlow.c
===================================================================
--- linux-2.6.24.orig/drivers/misc/intel_menlow.c
+++ linux-2.6.24/drivers/misc/intel_menlow.c
@@ -170,10 +170,13 @@ static int intel_menlow_memory_add(struc
 
 	cdev = thermal_cooling_device_register("Memory controller",
device,
 					       &memory_cooling_ops);
-	acpi_driver_data(device) = cdev;
-	if (!cdev)
-		result = -ENODEV;
-	else {
+	if (IS_ERR(cdev)) {
+		result = PTR_ERR(cdev);
+		goto end;
+	}
+
+	if (cdev) {
+		acpi_driver_data(device) = cdev;
 		result = sysfs_create_link(&device->dev.kobj,
 					&cdev->device.kobj,
"thermal_cooling");
 		if (result)

[-- Attachment #2: [patch 6 of 6] Intel Menlow - extract return value using PTR_ERR --]
[-- Type: application/octet-stream, Size: 1087 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

Need to extract errors using PTR_ERR macro and
process accordingly.thermal_cooling_device_register
returning NULL means that CONFIG_THERMAL=n and in that
case no need to create symbolic links.

Signed-off-by: Thomas Sujith <sujith.thomas@intel.com>
---

 drivers/misc/intel_menlow.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

Index: linux-2.6.24/drivers/misc/intel_menlow.c
===================================================================
--- linux-2.6.24.orig/drivers/misc/intel_menlow.c
+++ linux-2.6.24/drivers/misc/intel_menlow.c
@@ -170,10 +170,13 @@ static int intel_menlow_memory_add(struc
 
 	cdev = thermal_cooling_device_register("Memory controller", device,
 					       &memory_cooling_ops);
-	acpi_driver_data(device) = cdev;
-	if (!cdev)
-		result = -ENODEV;
-	else {
+	if (IS_ERR(cdev)) {
+		result = PTR_ERR(cdev);
+		goto end;
+	}
+
+	if (cdev) {
+		acpi_driver_data(device) = cdev;
 		result = sysfs_create_link(&device->dev.kobj,
 					&cdev->device.kobj, "thermal_cooling");
 		if (result)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-15  5:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15  5:25 [patch 6/6] Intel Menlow : extract return values using PTR_ERR Thomas, Sujith

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).