[alsa-devel] [PATCH 1/5] ASoC: dwc: Allocate resources with devm_ioremap_resource
Lars-Peter Clausen
lars at metafoo.de
Wed Dec 3 08:44:00 PST 2014
On 12/03/2014 05:38 PM, Andrew Jackson wrote:
[,,,[
> + dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
> + if (!dw_i2s_dai) {
> + dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
All the memory alloc functions already print a error message.
> return -ENOMEM;
> }
>
> + dw_i2s_dai->ops = &dw_i2s_dai_ops;
> + dw_i2s_dai->suspend = dw_i2s_suspend;
> + dw_i2s_dai->resume = dw_i2s_resume;
This seems to be separate from the devm_ioremap_resource() change.
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
You don't actually have to check it devm_ioremap_resource does this for you.
> + dev_err(&pdev->dev, "no i2s resource defined\n");
> + return -ENODEV;
> + }
> +
> + dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(dev->i2s_base)) {
> + dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
Same here devm_ioremap_resource() will already print a appropriate error
message.
> + return PTR_ERR(dev->i2s_base);
> + }
More information about the linux-arm-kernel
mailing list