Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755114Ab3FRLnk (ORCPT ); Tue, 18 Jun 2013 07:43:40 -0400 Received: from mail-ob0-f178.google.com ([209.85.214.178]:39532 "EHLO mail-ob0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754374Ab3FRLni (ORCPT ); Tue, 18 Jun 2013 07:43:38 -0400 MIME-Version: 1.0 In-Reply-To: <1371553171-23530-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1371553171-23530-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Date: Tue, 18 Jun 2013 17:13:37 +0530 Message-ID: Subject: Re: [PATCH] clocksource: sh_cmt: Use devm_* managed helpers From: Sachin Kamat To: Laurent Pinchart Cc: linux-sh@vger.kernel.org, Magnus Damm , linux-kernel@vger.kernel.org, Thomas Gleixner , John Stultz Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2541 Lines: 68 Hi Laurent, On 18 June 2013 16:29, Laurent Pinchart wrote: > This simplifies the main error path by getting rid of it. > > Signed-off-by: Laurent Pinchart > --- > drivers/clocksource/sh_cmt.c | 40 ++++++++++++++-------------------------- > 1 file changed, 14 insertions(+), 26 deletions(-) > > The patch is based on top of renesas-next-20130618 plus Magnus' > "clocksource: sh_cmt: 32-bit control register support" patch. > > diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c > index 0965e98..7001e4d 100644 > --- a/drivers/clocksource/sh_cmt.c > +++ b/drivers/clocksource/sh_cmt.c > @@ -681,20 +681,18 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) > struct sh_timer_config *cfg = pdev->dev.platform_data; > struct resource *res, *res2; > int irq, ret; > - ret = -ENXIO; > > - memset(p, 0, sizeof(*p)); > p->pdev = pdev; > > if (!cfg) { > dev_err(&p->pdev->dev, "missing platform data\n"); > - goto err0; > + return -ENXIO; > } > > res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); > if (!res) { > dev_err(&p->pdev->dev, "failed to get I/O memory\n"); > - goto err0; > + return -ENXIO; > } > > /* optional resource for the shared timer start/stop register */ > @@ -703,23 +701,23 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) > irq = platform_get_irq(p->pdev, 0); > if (irq < 0) { > dev_err(&p->pdev->dev, "failed to get irq\n"); > - goto err0; > + return -ENXIO; > } > > /* map memory, let mapbase point to our channel */ > - p->mapbase = ioremap_nocache(res->start, resource_size(res)); > + p->mapbase = devm_ioremap_resource(&pdev->dev, res); > if (p->mapbase == NULL) { You should check for IS_ERR (p->mapbase) and return PTR_ERR(p->mapbase) > dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); This error message is not required as devm_ioremap_resource prints its own. -- With warm regards, Sachin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/