1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-13 23:46:40 +00:00

fuse: simplify checks in fuse_get_reserved_odm and fuse_get_spare_bit (#54)

A separate variable isn't particularly necessary here, and given that the type
is unsigned, we only need to test the upper bound.

This also resolves two -Wtype-limits warnings
This commit is contained in:
Mat M 2018-02-26 00:23:31 -05:00 committed by SciresM
parent fff3912c81
commit 461105a501

View file

@ -132,23 +132,21 @@ uint32_t fuse_get_bootrom_patch_version(void)
/* Read a spare bit register from the shadow cache */ /* Read a spare bit register from the shadow cache */
uint32_t fuse_get_spare_bit(uint32_t idx) uint32_t fuse_get_spare_bit(uint32_t idx)
{ {
uint32_t spare_bit_val = 0; if (idx >= 32) {
return 0;
}
if ((idx >= 0) && (idx < 32)) return FUSE_CHIP_REGS->FUSE_SPARE_BIT[idx];
spare_bit_val = FUSE_CHIP_REGS->FUSE_SPARE_BIT[idx];
return spare_bit_val;
} }
/* Read a reserved ODM register from the shadow cache */ /* Read a reserved ODM register from the shadow cache */
uint32_t fuse_get_reserved_odm(uint32_t idx) uint32_t fuse_get_reserved_odm(uint32_t idx)
{ {
uint32_t reserved_odm_val = 0; if (idx >= 8) {
return 0;
}
if ((idx >= 0) && (idx < 8)) return FUSE_CHIP_REGS->FUSE_RESERVED_ODM[idx];
reserved_odm_val = FUSE_CHIP_REGS->FUSE_RESERVED_ODM[idx];
return reserved_odm_val;
} }
/* Derive the Device ID using values in the shadow cache */ /* Derive the Device ID using values in the shadow cache */