From mboxrd@z Thu Jan 1 00:00:00 1970 From: Libo Chen Subject: Re: [PATCH RFC v3 1/3] i2c: i2c-bfin-twi: convert to devm_* API Date: Fri, 24 May 2013 11:09:26 +0800 Message-ID: <519ED9E6.8050309@huawei.com> References: <1369310405-21112-1-git-send-email-libo.chen@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Zhang, Sonic" Cc: Libo Chen , "wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org" , "guz.fnst-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org" , "uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org" , "linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org" List-Id: linux-i2c@vger.kernel.org On 2013/5/24 10:49, Zhang, Sonic wrote: >> >- iface = kzalloc(sizeof(struct bfin_twi_iface), GFP_KERNEL); >> >+ iface = devm_kzalloc(&pdev->dev, sizeof(struct bfin_twi_iface), >> >+ GFP_KERNEL); >> > if (!iface) { >> > dev_err(&pdev->dev, "Cannot allocate memory\n"); >> >- rc = -ENOMEM; >> >- goto out_error_nomem; >> >+ return -ENOMEM; >> > } >> > >> > spin_lock_init(&(iface->lock)); >> > >> > /* Find and map our resources */ >> > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> >- if (res == NULL) { >> >- dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); >> >- rc = -ENOENT; >> >- goto out_error_get_res; >> >- } > Why remove the resource mem check? > > Regards, > > Sonic devm_ioremap_resource() had done for us, you can refernce the function`comment. Thanks, Libo