Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpupower: Fix NULL but dereferenced coccicheck errors

Fix NULL but dereferenced coccicheck errors found by:

make coccicheck MODE=report M=tools/power/cpupower

tools/power/cpupower/lib/cpufreq.c:384:19-23: ERROR: first is NULL but dereferenced.
tools/power/cpupower/lib/cpufreq.c:440:19-23: ERROR: first is NULL but dereferenced.
tools/power/cpupower/lib/cpufreq.c:308:19-23: ERROR: first is NULL but dereferenced.
tools/power/cpupower/lib/cpufreq.c:753:19-23: ERROR: first is NULL but dereferenced.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

+5 -5
+5 -5
tools/power/cpupower/lib/cpufreq.c
··· 285 285 } else { 286 286 first = malloc(sizeof(*first)); 287 287 if (!first) 288 - goto error_out; 288 + return NULL; 289 289 current = first; 290 290 } 291 291 current->first = first; ··· 362 362 } else { 363 363 first = malloc(sizeof(*first)); 364 364 if (!first) 365 - goto error_out; 365 + return NULL; 366 366 current = first; 367 367 } 368 368 current->first = first; ··· 418 418 } else { 419 419 first = malloc(sizeof(*first)); 420 420 if (!first) 421 - goto error_out; 421 + return NULL; 422 422 current = first; 423 423 } 424 424 current->first = first; ··· 493 493 } else { 494 494 first = malloc(sizeof(*first)); 495 495 if (!first) 496 - goto error_out; 496 + return NULL; 497 497 current = first; 498 498 } 499 499 current->first = first; ··· 726 726 } else { 727 727 first = malloc(sizeof(*first)); 728 728 if (!first) 729 - goto error_out; 729 + return NULL; 730 730 current = first; 731 731 } 732 732 current->first = first;