Re: [PATCH] cpsw: Add support to read cpu MAC address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 11, 2013 at 04:15:02PM +0100, Michal Bachraty wrote:
> +	if (!request_mem_region(priv->conf_res->start,
> +			resource_size(priv->conf_res), ndev->name)) {
> +		dev_err(priv->dev, "failed request i/o region\n");
> +		ret = -ENXIO;
> +		goto clean_clk_ret;
> +	}
> +
> +	regs = ioremap(priv->conf_res->start,
> +				resource_size(priv->conf_res));
> +	if (!regs) {
> +		dev_err(priv->dev, "unable to map i/o region\n");
> +		goto clean_configuration_iores_ret;
> +	}

In this day and age where error paths don't get any testing, and are
frequently buggy, where we have alternative APIs which make those paths
more reliable, I think we should do everything to make use of that.

And, to prove the point, your error paths are buggy.  Yes, you release
the mem region correctly (well done for picking the right interface for
that!) but the ioremap() is never cleaned up.

So, any chance of converting the above to devm_request_and_ioremap() ?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux