Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Commit

Permalink
Return -ENODEV for CPUs that don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
palmer-dabbelt committed May 24, 2017
1 parent ffa58d0 commit 10ef72b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/riscv/kernel/cpu.c
Expand Up @@ -22,17 +22,17 @@ int riscv_of_processor_hart(struct device_node *node)
u32 hart;

if (!of_device_is_compatible(node, "riscv"))
return -1;
return -(ENODEV);
if (of_property_read_u32(node, "reg", &hart)
|| hart >= NR_CPUS)
return -1;
return -(ENODEV);
if (of_property_read_string(node, "status", &status)
|| strcmp(status, "okay"))
return -1;
return -(ENODEV);
if (of_property_read_string(node, "riscv,isa", &isa)
|| isa[0] != 'r'
|| isa[1] != 'v')
return -1;
return -(ENODEV);

return hart;
}
Expand Down

0 comments on commit 10ef72b

Please sign in to comment.