提交 bcf4d812 编写于 作者: J Julia Lawall 提交者: David S. Miller

drivers/net: Correct NULL test

Test the value that was just allocated rather than the previously tested one.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression *x;
expression e;
identifier l;
@@

if (x == NULL || ...) {
    ... when forall
    return ...; }
... when != goto l;
    when != x = e
    when != &x
*x == NULL
// </smpl>
Signed-off-by: NJulia Lawall <julia@diku.dk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3af26f58
...@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev) ...@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev)
size = (res->end - res->start) + 1; size = (res->end - res->start) + 1;
ax->mem2 = request_mem_region(res->start, size, pdev->name); ax->mem2 = request_mem_region(res->start, size, pdev->name);
if (ax->mem == NULL) { if (ax->mem2 == NULL) {
dev_err(&pdev->dev, "cannot reserve registers\n"); dev_err(&pdev->dev, "cannot reserve registers\n");
ret = -ENXIO; ret = -ENXIO;
goto exit_mem1; goto exit_mem1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册