OSDN Git Service

powerpc/pseries: Fix bad drc_index_start value parsing of drc-info entry
authorTyrel Datwyler <tyreld@linux.ibm.com>
Mon, 11 Nov 2019 05:21:28 +0000 (23:21 -0600)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 05:57:56 +0000 (16:57 +1100)
commit57409d4fb12c185b2c0689e0496878c8f6bb5b58
tree029f32c5695bfc62b28bb749e572bfca63831d42
parentd34a5709be85e88a8bb7537cd38b8eca8085047a
powerpc/pseries: Fix bad drc_index_start value parsing of drc-info entry

The ibm,drc-info property is an array property that contains drc-info
entries such that each entry is made up of 2 string encoded elements
followed by 5 int encoded elements. The of_read_drc_info_cell()
helper contains comments that correctly name the expected elements
and their encoding. However, the usage of of_prop_next_string() and
of_prop_next_u32() introduced a subtle skippage of the first u32.
This is a result of of_prop_next_string() returning a pointer to the
next property value which is not a string, but actually a (__be32 *).
As, a result the following call to of_prop_next_u32() passes over the
current int encoded value and actually stores the next one wrongly.

Simply endian swap the current value in place after reading the first
two string values. The remaining int encoded values can then be read
correctly using of_prop_next_u32().

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1573449697-5448-2-git-send-email-tyreld@linux.ibm.com
arch/powerpc/platforms/pseries/of_helpers.c