Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756215Ab3EPIlf (ORCPT ); Thu, 16 May 2013 04:41:35 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:49658 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756117Ab3EPIlc (ORCPT ); Thu, 16 May 2013 04:41:32 -0400 X-AuditID: cbfee68d-b7f096d0000043fc-4b-51949bb8f3f0 Date: Thu, 16 May 2013 08:41:28 +0000 (GMT) From: Jingoo Han Subject: Re: [PATCH] drivers: video: mxsfb: clean use of devm_ioremap_resource() To: Laurent Navet , "FlorianSchandinat@gmx.de" Cc: "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jingoo Han Reply-to: jg1.han@samsung.com MIME-version: 1.0 X-MTR: 20130516084056860@jg1.han Msgkey: 20130516084056860@jg1.han X-EPLocale: en_US.euc-kr X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-EPTrCode: X-EPTrName: X-MLAttribute: X-RootMTR: 20130516084056860@jg1.han X-ParentMTR: X-ArchiveUser: EV X-CPGSPASS: N Content-type: text/plain; charset=euc-kr MIME-version: 1.0 Message-id: <19650694.136921368693687337.JavaMail.weblogic@epml12> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIJsWRmVeSWpSXmKPExsVy+t8zA92ds6cEGnz2sbi8aw6bA6PH501y AYxRDYw2iUXJGZllqQqpecn5KZl56bZKoSFuuhZKChn5xSW2StFGBsZ6RqYmekYm5nqWBrFW RqZKCnmJuam2ShW6UL1KCkXJBUC1uZXFQANyUvWg4nrFqXkpDln5pSCH6BUn5haX5qXrJefn KimUJeaUAo1Q0k+YypjR88awYIdoxZQvd9kaGN+IdDFycggJKElMOrmXsYuRg0NCwETi3VVm kLCEgJjEhXvr2boYuYBKljFKzGlYzwKRMJG4vaWDBSIxn1Hi79oj7CAJFg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xo/0pVL2c xLSva5ghbGmJ87M2MMJcvfj7Y6g4v8Sx2zuADuUA631yPxhmzO7NX9ggbAGJqWcOQrUC/TV/ JTuEzSexZuFbqFWCEqevdTPD9N7fMhfsd2agM6d0P2SHsLUkvvzYx4bqLQ4g20niwF/rCYxy s5BkZiHpnoWkG1nNAkaWVYyiqQXJBcVJ6RVGesWJucWleel6yfm5mxjBCerZoh2M/85bH2IU 4GBU4uE9kTAlUIg1say4MvcQowQHs5II74xUoBBvSmJlVWpRfnxRaU5q8SHGZGAETmSWEk3O BybPvJJ4Q2NjEzMTU3MDCwNLc9KElcR5n7VaBwoJpCeWpGanphakFsFsYeLglGpgXKrfpVIQ ejeN67nlTLl1Fy7vU9FuecS15eSElsPOT3JuJjc18XIxWWgczDxT9W6jqxbf3ju6bAmtUqtC ZeRvN3TPk/n2V+/EhttZmWd28kyzFli81uUUo3rJ7I/n/aPXrTr/KPwq95ZlU7ZnnnB5E3vC Zvl/06g9KUdOatVJ/HWcZ1t+QtXOVomlOCPRUIu5qDgRAGVCEx+UAwAA DLP-Filter: Pass X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id r4G8fdDF020906 Content-Length: 2097 Lines: 64 Tuesday, May 14, 2013 6:25 PM, Laurent Navet wrote: > > Check of 'res' and calls to dev_err are already done in devm_ioremap_resource, > so no need to do them twice. > > Signed-off-by: Laurent Navet > --- > drivers/video/mxsfb.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c > index 21223d4..0f3d0fc 100644 > --- a/drivers/video/mxsfb.c > +++ b/drivers/video/mxsfb.c > @@ -884,9 +884,10 @@ static int mxsfb_probe(struct platform_device *pdev) > pdev->id_entry = of_id->data; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(&pdev->dev, "Cannot get memory IO resource\n"); > - return -ENODEV; > + host->base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(host->base)) { > + ret = PTR_ERR(host->base); > + goto fb_release; It makes build warning as below: drivers/video/mxsfb.c:887:13: warning: 'host' is used uninitialized in this function [-Wuninitialized] drivers/video/mxsfb.c:965:21: warning: 'fb_info' may be used uninitialized in this function [-Wuninitialized] It breaks the assignment. host = to_imxfb_host(fb_info); Also, 'goto fb_release;' is not good. Please use ' return PTR_ERR(host->base);' as below: + host->base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(host->base)) + return PTR_ERR(host->base); Best regards, Jingoo Han > } > > fb_info = framebuffer_alloc(sizeof(struct mxsfb_info), &pdev->dev); > @@ -897,13 +898,6 @@ static int mxsfb_probe(struct platform_device *pdev) > > host = to_imxfb_host(fb_info); > > - host->base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(host->base)) { > - dev_err(&pdev->dev, "ioremap failed\n"); > - ret = PTR_ERR(host->base); > - goto fb_release; > - } > - > host->pdev = pdev; > platform_set_drvdata(pdev, host); > > -- > 1.7.10.4 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?