Skip to content

Commit d8f4ed0

Browse files
committed
ACPI: processor: perflib: Drop redundant parentheses
Drop some redundant parentheses and rearrange some checks using them in the ACPI processor performance library code for better code clarity. No expected functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 3d9e9a9 commit d8f4ed0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/acpi/processor_perflib.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
202202
}
203203

204204
pct = (union acpi_object *)buffer.pointer;
205-
if (!pct || (pct->type != ACPI_TYPE_PACKAGE) || (pct->package.count != 2)) {
205+
if (!pct || pct->type != ACPI_TYPE_PACKAGE || pct->package.count != 2) {
206206
pr_err("Invalid _PCT data\n");
207207
result = -EFAULT;
208208
goto end;
@@ -214,9 +214,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
214214

215215
obj = pct->package.elements[0];
216216

217-
if ((obj.type != ACPI_TYPE_BUFFER) ||
218-
(obj.buffer.length < sizeof(struct acpi_pct_register)) ||
219-
(obj.buffer.pointer == NULL)) {
217+
if (!obj.buffer.pointer || obj.type != ACPI_TYPE_BUFFER ||
218+
obj.buffer.length < sizeof(struct acpi_pct_register)) {
220219
pr_err("Invalid _PCT data (control_register)\n");
221220
result = -EFAULT;
222221
goto end;
@@ -230,9 +229,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
230229

231230
obj = pct->package.elements[1];
232231

233-
if ((obj.type != ACPI_TYPE_BUFFER) ||
234-
(obj.buffer.length < sizeof(struct acpi_pct_register)) ||
235-
(obj.buffer.pointer == NULL)) {
232+
if (!obj.buffer.pointer || obj.type != ACPI_TYPE_BUFFER ||
233+
obj.buffer.length < sizeof(struct acpi_pct_register)) {
236234
pr_err("Invalid _PCT data (status_register)\n");
237235
result = -EFAULT;
238236
goto end;
@@ -300,7 +298,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
300298
}
301299

302300
pss = buffer.pointer;
303-
if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
301+
if (!pss || pss->type != ACPI_TYPE_PACKAGE) {
304302
pr_err("Invalid _PSS data\n");
305303
result = -EFAULT;
306304
goto end;
@@ -353,7 +351,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
353351
* Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq
354352
*/
355353
if (!px->core_frequency ||
356-
((u32)(px->core_frequency * 1000) != (px->core_frequency * 1000))) {
354+
(u32)(px->core_frequency * 1000) != px->core_frequency * 1000) {
357355
pr_err(FW_BUG
358356
"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
359357
pr->id, px->core_frequency);
@@ -515,7 +513,7 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
515513
}
516514

517515
psd = buffer.pointer;
518-
if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
516+
if (!psd || psd->type != ACPI_TYPE_PACKAGE) {
519517
pr_err("Invalid _PSD data\n");
520518
result = -EFAULT;
521519
goto end;

0 commit comments

Comments
 (0)