Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

remoteproc: qcom: pil_info: avoid 64-bit division

On 32-bit machines with 64-bit resource_size_t, the driver causes
a link failure because of the 64-bit division:

arm-linux-gnueabi-ld: drivers/remoteproc/qcom_pil_info.o: in function `qcom_pil_info_store':
qcom_pil_info.c:(.text+0x1ec): undefined reference to `__aeabi_uldivmod'

Add a cast to an u32 to avoid this. If the resource exceeds 4GB,
there are bigger problems.

Fixes: 549b67da660d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210103135628.3702427-1-arnd@kernel.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

authored by

Arnd Bergmann and committed by
Bjorn Andersson
7029e783 a38fd874

+1 -1
+1 -1
drivers/remoteproc/qcom_pil_info.c
··· 56 56 memset_io(base, 0, resource_size(&imem)); 57 57 58 58 _reloc.base = base; 59 - _reloc.num_entries = resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; 59 + _reloc.num_entries = (u32)resource_size(&imem) / PIL_RELOC_ENTRY_SIZE; 60 60 61 61 return 0; 62 62 }