[PATCH v2 13/16] drivers/bus: add ARM CCI support
saeed bishara
saeed.bishara at gmail.com
Thu Jan 24 16:05:12 EST 2013
On Thu, Jan 24, 2013 at 8:27 AM, Nicolas Pitre <nicolas.pitre at linaro.org> wrote:
> +static int cci_driver_probe(struct platform_device *pdev)
> +{
> + struct resource *res;
> + int ret = 0;
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
devm_kzalloc and managed resources allocation can save you few code lines.
> + if (!info) {
> + dev_err(&pdev->dev, "unable to allocate mem\n");
> + return -ENOMEM;
> + }
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(&pdev->dev, "No memory resource\n");
> + ret = -EINVAL;
> + goto mem_free;
> + }
> +
> + if (!request_mem_region(res->start, resource_size(res),
> + dev_name(&pdev->dev))) {
> + dev_err(&pdev->dev, "address 0x%x in use\n", (u32) res->start);
I suggest that you use %pR or %pr (more info at Documentation/prink-formats.txt
also, request_mem_region can fail due to other reasons
> + ret = -EBUSY;
> + goto mem_free;
More information about the linux-arm-kernel
mailing list