diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-12-06 00:14:21 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-12-11 17:49:47 +0100 |
commit | 169f9acae08685d4f2a6fd32983958d44e10905d (patch) | |
tree | 7b72d21e87f288729ab851ef42b7361003769d7a /drivers/spi/spi-dw.c | |
parent | spi: bitbang: Make chipselect callback optional (diff) | |
download | linux-169f9acae08685d4f2a6fd32983958d44e10905d.tar.xz linux-169f9acae08685d4f2a6fd32983958d44e10905d.zip |
spi: dw: Avoid BUG_ON() in case of host failure
If dws is NULL in dw_spi_host_add(), we return the error to the
upper callers instead of crashing. The patch replaces BUG_ON by
returning -EINVAL to the caller.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Link: https://lore.kernel.org/r/20191205231421.9333-1-pakki001@umn.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-dw.c')
-rw-r--r-- | drivers/spi/spi-dw.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index a92aa5cd4fbe..a160d9a141ea 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -460,7 +460,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) struct spi_controller *master; int ret; - BUG_ON(dws == NULL); + if (!dws) + return -EINVAL; master = spi_alloc_master(dev, 0); if (!master) |