diff options
| author | rbuj <[email protected]> | 2020-07-20 23:10:50 +0200 | 
|---|---|---|
| committer | raveit65 <[email protected]> | 2020-08-05 15:44:52 +0200 | 
| commit | 5cbe2698bd1b575774b33e28ab365e0695313e88 (patch) | |
| tree | e2aaef262714097b8e5fad609c4c939eb3d83988 /cpufreq/src | |
| parent | 1d33457ebae8cd471a1d1d02cd8c8175e365dea6 (diff) | |
| download | mate-applets-5cbe2698bd1b575774b33e28ab365e0695313e88.tar.bz2 mate-applets-5cbe2698bd1b575774b33e28ab365e0695313e88.tar.xz  | |
cpufreq: Remove warning about unreachable code reported by scan-build
Diffstat (limited to 'cpufreq/src')
| -rw-r--r-- | cpufreq/src/cpufreq-monitor-factory.c | 49 | 
1 files changed, 24 insertions, 25 deletions
diff --git a/cpufreq/src/cpufreq-monitor-factory.c b/cpufreq/src/cpufreq-monitor-factory.c index 4e8dbaa9..c7942cba 100644 --- a/cpufreq/src/cpufreq-monitor-factory.c +++ b/cpufreq/src/cpufreq-monitor-factory.c @@ -39,31 +39,30 @@  CPUFreqMonitor *  cpufreq_monitor_factory_create_monitor (guint cpu)  { -	   CPUFreqMonitor *monitor = NULL; -  #ifdef HAVE_LIBCPUFREQ -	   monitor = cpufreq_monitor_libcpufreq_new (cpu); -	   return monitor; -#endif	 -	    -	   if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */ -		   monitor = cpufreq_monitor_sysfs_new (cpu); -	   } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel (Deprecated)*/ -		   monitor = cpufreq_monitor_procfs_new (cpu); -	   } else if (g_file_test ("/proc/cpuinfo", G_FILE_TEST_EXISTS)) { -		   /* If there is no cpufreq support it shows only the cpu frequency, -		    * I think is better than do nothing. I have to notify it to the user, because -		    * he could think that cpufreq is supported but it doesn't work succesfully -		    */ -		    -		   cpufreq_utils_display_error (_("CPU frequency scaling unsupported"), -						_("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.")); -		    -		   monitor = cpufreq_monitor_cpuinfo_new (cpu); -	   } -	    -	   return monitor; +        return cpufreq_monitor_libcpufreq_new (cpu); +#else +        CPUFreqMonitor *monitor = NULL; + +        if (g_file_test ("/sys/devices/system/cpu/cpu0/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.6 kernel */ +                monitor = cpufreq_monitor_sysfs_new (cpu); +        } else if (g_file_test ("/proc/cpufreq", G_FILE_TEST_EXISTS)) { /* 2.4 kernel (Deprecated)*/ +                monitor = cpufreq_monitor_procfs_new (cpu); +        } else if (g_file_test ("/proc/cpuinfo", G_FILE_TEST_EXISTS)) { +                /* If there is no cpufreq support it shows only the cpu frequency, +                 * I think is better than do nothing. I have to notify it to the user, because +                 * he could think that cpufreq is supported but it doesn't work succesfully +                 */ + +                cpufreq_utils_display_error (_("CPU frequency scaling unsupported"), +                                             _("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.")); + +                monitor = cpufreq_monitor_cpuinfo_new (cpu); +        } + +        return monitor; +#endif  }  | 
