Skip to content

Commit 8928e91

Browse files
Lee Jonesarndb
authored andcommitted
soc: qcom: geni: Provide parameter error checking
When booting with ACPI, the Geni Serial Engine is not set as the I2C/SPI parent and thus, the wrapper (parent device) is unassigned. This causes the kernel to crash with a null dereference error. Link: https://lore.kernel.org/r/[email protected] Fixes: 8bc529b ("soc: qcom: geni: Add support for ACPI") Acked-by: Bjorn Andersson <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Lee Jones <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 13212a6 commit 8928e91

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/soc/qcom/qcom-geni-se.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ int geni_se_tx_dma_prep(struct geni_se *se, void *buf, size_t len,
630630
struct geni_wrapper *wrapper = se->wrapper;
631631
u32 val;
632632

633+
if (!wrapper)
634+
return -EINVAL;
635+
633636
*iova = dma_map_single(wrapper->dev, buf, len, DMA_TO_DEVICE);
634637
if (dma_mapping_error(wrapper->dev, *iova))
635638
return -EIO;
@@ -663,6 +666,9 @@ int geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len,
663666
struct geni_wrapper *wrapper = se->wrapper;
664667
u32 val;
665668

669+
if (!wrapper)
670+
return -EINVAL;
671+
666672
*iova = dma_map_single(wrapper->dev, buf, len, DMA_FROM_DEVICE);
667673
if (dma_mapping_error(wrapper->dev, *iova))
668674
return -EIO;

0 commit comments

Comments
 (0)