瀏覽代碼

staging: fsl-mc: Fixed WARN_ON() in fsl_mc_resource_pool_remove_device

Check that resource is not NULL before de-referencing it.

Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
J. German Rivera 9 年之前
父節點
當前提交
2379bdbc6c
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/staging/fsl-mc/bus/mc-allocator.c

+ 1 - 1
drivers/staging/fsl-mc/bus/mc-allocator.c

@@ -111,7 +111,7 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
 		goto out;
 		goto out;
 
 
 	resource = mc_dev->resource;
 	resource = mc_dev->resource;
-	if (WARN_ON(resource->data != mc_dev))
+	if (WARN_ON(!resource || resource->data != mc_dev))
 		goto out;
 		goto out;
 
 
 	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
 	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);