get_one_cpu_topology: Fix error-handling
Fix the error handling of the following two functions:
ihk_device_get_cpu_topology: Returns NULL when not found,
valid non-NULL pointer when found
get_cache_topology: Returns NULL when not found,
valid non-NULL pointer when found,
minus error number on error
Change-Id: Ied13a61d4ab0c314477c45ea659ff2b798ad97ee
Fujitsu: POSTK_DEBUG_TEMP_FIX_21
This commit is contained in:
@@ -387,12 +387,8 @@ static struct cpu_topology *get_one_cpu_topology(struct mcctrl_usrdata *udp,
|
|||||||
topology->saved = ihk_device_get_cpu_topology(dev,
|
topology->saved = ihk_device_get_cpu_topology(dev,
|
||||||
mckernel_cpu_2_hw_id(udp, index));
|
mckernel_cpu_2_hw_id(udp, index));
|
||||||
|
|
||||||
#ifdef POSTK_DEBUG_TEMP_FIX_21 /* IS_ERR() through return NULL */
|
|
||||||
if (!topology->saved) {
|
if (!topology->saved) {
|
||||||
#else /* POSTK_DEBUG_TEMP_FIX_21 */
|
error = -ENOENT;
|
||||||
if (IS_ERR(topology->saved)) {
|
|
||||||
#endif /* POSTK_DEBUG_TEMP_FIX_21 */
|
|
||||||
error = PTR_ERR(topology->saved);
|
|
||||||
eprintk("mcctrl:get_one_cpu_topology:"
|
eprintk("mcctrl:get_one_cpu_topology:"
|
||||||
"ihk_device_get_cpu_topology failed. %d\n",
|
"ihk_device_get_cpu_topology failed. %d\n",
|
||||||
error);
|
error);
|
||||||
@@ -428,6 +424,9 @@ static struct cpu_topology *get_one_cpu_topology(struct mcctrl_usrdata *udp,
|
|||||||
"get_cache_topology failed. %d\n",
|
"get_cache_topology failed. %d\n",
|
||||||
error);
|
error);
|
||||||
goto out;
|
goto out;
|
||||||
|
} else if (!cache) {
|
||||||
|
error = -ENOENT;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add(&cache->chain, &topology->cache_list);
|
list_add(&cache->chain, &topology->cache_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user