[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <001401cf3447$9ecbc330$dc634990$%han@samsung.com>
Date: Fri, 28 Feb 2014 14:40:42 +0900
From: Jingoo Han <jg1.han@...sung.com>
To: 'David Miller' <davem@...emloft.net>
Cc: netdev@...r.kernel.org, msink@...monline.ru,
'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH 1/2] net: w5300: Use devm_ioremap_resource()
On Friday, February 28, 2014 7:07 AM, David Miller wrote:
> 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.
OK, I see.
I agree with your opinion. I will send v2 patch, soon.
Thank you for your comment.
Best regards,
Jingoo Han
>
> 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