diff --git a/drivers/spi/spi-phytium-plat-v2.c b/drivers/spi/spi-phytium-plat-v2.c index 73fc2e5f09a944c8367c9ae6bbc1a4e63a3fcc5b..0cd8240b951d5915fbf66ebf2fda2f8c844f7837 100644 --- a/drivers/spi/spi-phytium-plat-v2.c +++ b/drivers/spi/spi-phytium-plat-v2.c @@ -239,8 +239,12 @@ static int spi_phyt_probe(struct platform_device *pdev) goto out; } - cs_gpio = desc_to_gpio(gpiod); - cs[i] = cs_gpio; + if (gpiod) { + cs_gpio = desc_to_gpio(gpiod); + cs[i] = cs_gpio; + } else { + cs[i] = -ENOENT; + } } } diff --git a/drivers/spi/spi-phytium-plat.c b/drivers/spi/spi-phytium-plat.c index 2b2517c6f9007c60082559c943533f5c36904459..840523df515838dc503949b68e010c8069630a64 100644 --- a/drivers/spi/spi-phytium-plat.c +++ b/drivers/spi/spi-phytium-plat.c @@ -131,8 +131,12 @@ static int phytium_spi_probe(struct platform_device *pdev) goto out; } - cs_gpio = desc_to_gpio(gpiod); - cs[i] = cs_gpio; + if (gpiod) { + cs_gpio = desc_to_gpio(gpiod); + cs[i] = cs_gpio; + } else { + cs[i] = -ENOENT; + } } }