Bug Summary

File:cpufreq/src/cpufreq-monitor-factory.c
Warning:line 49, column 9
This statement is never executed

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name cpufreq-monitor-factory.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/cpufreq/src -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I ../.. -D CPUFREQ_MENU_UI_DIR="/usr/share/cafe/ui" -I /usr/include/cafe-panel-4.0/libcafe-panel-applet -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/cpufreq/src -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-08-06-112337-86002-1 -x c cpufreq-monitor-factory.c
1/*
2 * CAFE CPUFreq Applet
3 * Copyright (C) 2004 Carlos Garcia Campos <carlosgc@gnome.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 * Authors : Carlos García Campos <carlosgc@gnome.org>
20 */
21
22#ifdef HAVE_CONFIG_H1
23#include "config.h"
24#endif
25
26#include <glib.h>
27#include <glib/gi18n.h>
28
29#include "cpufreq-applet.h"
30#include "cpufreq-utils.h"
31#include "cpufreq-monitor-sysfs.h"
32#include "cpufreq-monitor-procfs.h"
33#include "cpufreq-monitor-cpuinfo.h"
34#ifdef HAVE_LIBCPUFREQ1
35#include "cpufreq-monitor-libcpufreq.h"
36#endif
37#include "cpufreq-monitor-factory.h"
38
39CPUFreqMonitor *
40cpufreq_monitor_factory_create_monitor (guint cpu)
41{
42 CPUFreqMonitor *monitor = NULL((void*)0);
43
44#ifdef HAVE_LIBCPUFREQ1
45 monitor = cpufreq_monitor_libcpufreq_new (cpu);
46 return monitor;
47#endif
48
49 if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */
This statement is never executed
50 monitor = cpufreq_monitor_sysfs_new (cpu);
51 } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel (Deprecated)*/
52 monitor = cpufreq_monitor_procfs_new (cpu);
53 } else if (g_file_test ("/proc/cpuinfo", G_FILE_TEST_EXISTS)) {
54 /* If there is no cpufreq support it shows only the cpu frequency,
55 * I think is better than do nothing. I have to notify it to the user, because
56 * he could think that cpufreq is supported but it doesn't work succesfully
57 */
58
59 cpufreq_utils_display_error (_("CPU frequency scaling unsupported")gettext ("CPU frequency scaling unsupported"),
60 _("You will not be able to modify the frequency of your machine. "gettext ("You will not be able to modify the frequency of your machine. "
"Your machine may be misconfigured or not have hardware support "
"for CPU frequency scaling.")
61 "Your machine may be misconfigured or not have hardware support "gettext ("You will not be able to modify the frequency of your machine. "
"Your machine may be misconfigured or not have hardware support "
"for CPU frequency scaling.")
62 "for CPU frequency scaling.")gettext ("You will not be able to modify the frequency of your machine. "
"Your machine may be misconfigured or not have hardware support "
"for CPU frequency scaling.")
);
63
64 monitor = cpufreq_monitor_cpuinfo_new (cpu);
65 }
66
67 return monitor;
68}
69