[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140227.170641.962779709265574310.davem@davemloft.net>
Date: Thu, 27 Feb 2014 17:06:41 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: jg1.han@...sung.com
Cc: netdev@...r.kernel.org, msink@...monline.ru
Subject: Re: [PATCH 1/2] net: w5300: Use devm_ioremap_resource()
From: Jingoo Han <jg1.han@...sung.com>
Date: Thu, 27 Feb 2014 19:30:04 +0900
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because the value is checked by devm_ioremap_resource().
>
> Signed-off-by: Jingoo Han <jg1.han@...sung.com>
I think the code with the NULL check removed is harder for semantic
checkers to figure out, because of what will look like a blind
dereference via resource_size(mem).
Unless all semantic checkers are going to learn the complete semantics
of devm_ioremap_resource(), in particular that it will signal an error
on a NULL second argument, and then the semantic checker will see
the complete control flow in the call site, I think we should keep
the NULL check.
Maybe recode this as:
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem)
return -ENXIO;
mem_size = resource_size(mem);
priv->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
Same goes for your other patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists