summaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorThomas Sujith <sujith.thomas@intel.com>2008-02-15 00:59:50 -0500
committerLen Brown <len.brown@intel.com>2008-02-15 18:21:30 -0500
commit3e6fda5c1159823fc02463eceb564c8bfc0e7a0e (patch)
tree38af580a57b553a902db25ec1401d8005885981d /drivers/thermal
parentc751670902c3dd9abbed279170a832e6a1e6cf94 (diff)
downloadop-kernel-dev-3e6fda5c1159823fc02463eceb564c8bfc0e7a0e.zip
op-kernel-dev-3e6fda5c1159823fc02463eceb564c8bfc0e7a0e.tar.gz
thermal: use ERR_PTR for returning error
Need to return using ERR_PTR instead of NULL in case of errors. Signed-off-by: Thomas Sujith <sujith.thomas@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 5f1d318..8b86e53 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -448,20 +448,20 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
int result;
if (strlen(type) >= THERMAL_NAME_LENGTH)
- return NULL;
+ return ERR_PTR(-EINVAL);
if (!ops || !ops->get_max_state || !ops->get_cur_state ||
!ops->set_cur_state)
- return NULL;
+ return ERR_PTR(-EINVAL);
cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL);
if (!cdev)
- return NULL;
+ return ERR_PTR(-ENOMEM);
result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id);
if (result) {
kfree(cdev);
- return NULL;
+ return ERR_PTR(result);
}
strcpy(cdev->type, type);
@@ -473,7 +473,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
if (result) {
release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
kfree(cdev);
- return NULL;
+ return ERR_PTR(result);
}
/* sys I/F */
@@ -509,7 +509,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
unregister:
release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
device_unregister(&cdev->device);
- return NULL;
+ return ERR_PTR(result);
}
EXPORT_SYMBOL(thermal_cooling_device_register);
@@ -581,17 +581,17 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
int count;
if (strlen(type) >= THERMAL_NAME_LENGTH)
- return NULL;
+ return ERR_PTR(-EINVAL);
if (trips > THERMAL_MAX_TRIPS || trips < 0)
- return NULL;
+ return ERR_PTR(-EINVAL);
if (!ops || !ops->get_temp)
- return NULL;
+ return ERR_PTR(-EINVAL);
tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);
if (!tz)
- return NULL;
+ return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&tz->cooling_devices);
idr_init(&tz->idr);
@@ -599,7 +599,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id);
if (result) {
kfree(tz);
- return NULL;
+ return ERR_PTR(result);
}
strcpy(tz->type, type);
@@ -612,7 +612,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
if (result) {
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
kfree(tz);
- return NULL;
+ return ERR_PTR(result);
}
/* sys I/F */
@@ -654,7 +654,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
unregister:
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
device_unregister(&tz->device);
- return NULL;
+ return ERR_PTR(result);
}
EXPORT_SYMBOL(thermal_zone_device_register);
OpenPOWER on IntegriCloud