Re: [PATCH-v3 06/11] i2c:pxa: Use devm_ variants in probe function

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

 




> -	i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
> +	i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL);
>  	if (!i2c) {
> -		ret = -ENOMEM;
> -		goto emalloc;
> +		dev_err(&dev->dev, "memory allocation failed\n");

No message here, we get a dump anyhow.

> +	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&dev->dev, "no mem resource\n");
> +		return -ENODEV;
> +	}

You can skip this check, devm_ioremap_resource will do it.

> +		dev_err(&dev->dev, "failed to get the clk: %ld\n",
> +			PTR_ERR(i2c->clk));

Sidenote for all patches: I am not so strict with the 80 char limit. I'd
think the above code would be more readable if it was one line. But you
decide.

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux