cpupower: Remove redundant error check
Remove double checks, and move the call to print_error to the
first check. Replace break by return, and return 0 on success.
The simplified version of the coccinelle semantic patch that
fixes this issue is as follows:
// <smpl>
@@
expression E; identifier pr; expression list es;
@@
for(...;...;...){
...
- if (E) break;
+ if (E){
+ pr(es);
+ break;
+ }
...
}
- if(E) pr(es);
// </smpl>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
13f6de52b1
commit
059802f961
@@ -320,12 +320,11 @@ int cmd_freq_set(int argc, char **argv)
|
|||||||
|
|
||||||
printf(_("Setting cpu: %d\n"), cpu);
|
printf(_("Setting cpu: %d\n"), cpu);
|
||||||
ret = do_one_cpu(cpu, &new_pol, freq, policychange);
|
ret = do_one_cpu(cpu, &new_pol, freq, policychange);
|
||||||
if (ret)
|
if (ret) {
|
||||||
break;
|
print_error();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
return 0;
|
||||||
print_error();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user