]> git.baikalelectronics.ru Git - kernel.git/commit
of/address: Return an error when no valid dma-ranges are found
authorMark Brown <broonie@kernel.org>
Sat, 28 Jan 2023 17:47:50 +0000 (17:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2023 18:11:42 +0000 (19:11 +0100)
commitb8aa3cb184c0f7df813301a9d620e314cdd3c751
tree8a4d0bfd45473127970a223e1eedaed215983af4
parent66f1e0364cc04bd23adb48ae6d17744c7cfd9b3c
of/address: Return an error when no valid dma-ranges are found

commit fd927b6096d0cf69bb636616bd3d84198a0206e7 upstream.

Commit db9d36c5db4a ("of/address: use range parser for of_dma_get_range")
converted the parsing of dma-range properties to use code shared with the
PCI range parser. The intent was to introduce no functional changes however
in the case where we fail to translate the first resource instead of
returning -EINVAL the new code we return 0. Restore the previous behaviour
by returning an error if we find no valid ranges, the original code only
handled the first range but subsequently support for parsing all supplied
ranges was added.

This avoids confusing code using the parsed ranges which doesn't expect to
successfully parse ranges but have only a list terminator returned, this
fixes breakage with so far as I can tell all DMA for on SoC devices on the
Socionext Synquacer platform which has a firmware supplied DT. A bisect
identified the original conversion as triggering the issues there.

Fixes: db9d36c5db4a ("of/address: use range parser for of_dma_get_range")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Luca Di Stefano <luca.distefano@linaro.org>
Cc: 993612@bugs.debian.org
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230126-synquacer-boot-v2-1-cb80fd23c4e2@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/address.c