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 11479fcfe0533b9f86c255f0e5974dfe14ee18a3..cf31b107de5bfb5b94d12d37d882395244d87a2c 100644 --- a/drivers/spi/spi-phytium-plat.c +++ b/drivers/spi/spi-phytium-plat.c @@ -126,8 +126,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; + } } }