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>
        struct spi_controller *master;
        int ret;
 
-       BUG_ON(dws == NULL);
+       if (!dws)
+               return -EINVAL;
 
        master = spi_alloc_master(dev, 0);
        if (!master)