未验证 提交 169f9aca 编写于 作者: A Aditya Pakki 提交者: Mark Brown

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: NAditya Pakki <pakki001@umn.edu>
Link: https://lore.kernel.org/r/20191205231421.9333-1-pakki001@umn.eduSigned-off-by: NMark Brown <broonie@kernel.org>
上级 4a07b8bc
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册