From patchwork Mon Mar 24 08:26:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Hermant X-Patchwork-Id: 332980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wg0-x23d.google.com (mail-wg0-x23d.google.com [IPv6:2a00:1450:400c:c00::23d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8FB1D2C00C2 for ; Mon, 24 Mar 2014 19:26:53 +1100 (EST) Received: by mail-wg0-f61.google.com with SMTP id l18sf304112wgh.6 for ; Mon, 24 Mar 2014 01:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=QyDcKY6LsdGt1ovYK5jo3ppdKX3nVf0R2vlc6jawJN0=; b=gKW57evW534CFpSmwnbDXOVhFMu2/7z8HNfJR6xBZ/Di41MP4XuiXXWjEeQkD4q1nO wrlnlV/JiR22TIx8B432TwZtjUYH/dLp/mmicKhKemHI3bR4HHMaohvJOox3f9m0h8a4 ynrTWZHyuncAPXBz/vIs+wGLRq4/mKFf0JyPv7ZB9OqdplhmS07R/bLdvSpIPrwmTHjf UBswVflmNuA3xlZKRu6tsYcoR+ouNMs8Z6tYZ5EZ82qjadoRvXvWEzRuMsRmCejsl1r5 pBOyTO4AMp++bmz5l1VHtGD4PBVh/rlCBzcIj42No0rZtO0cUY2Ny0pHGhuYEkoICUiF r9rw== X-Received: by 10.180.37.77 with SMTP id w13mr26495wij.13.1395649609597; Mon, 24 Mar 2014 01:26:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.99.199 with SMTP id es7ls373657wib.5.canary; Mon, 24 Mar 2014 01:26:49 -0700 (PDT) X-Received: by 10.180.108.75 with SMTP id hi11mr5925595wib.0.1395649609055; Mon, 24 Mar 2014 01:26:49 -0700 (PDT) Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de. [2a01:238:20a:202:5300::5]) by gmr-mx.google.com with ESMTPS id u49si1727560eeo.1.2014.03.24.01.26.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Mar 2014 01:26:48 -0700 (PDT) Received-SPF: neutral (google.com: 2a01:238:20a:202:5300::5 is neither permitted nor denied by best guess record for domain of gregory.hermant@calao-systems.com) client-ip=2a01:238:20a:202:5300::5; X-RZG-AUTH: :K34Bck+6YrEgjuBfzmrkukPJhhbHEm1G+2SCnvvjhur6rsGj/j85wMsCLAiUaMBfeopIQ7K1rETU7znlgrmlWw== X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain (sta01-1-88-175-212-11.fbx.proxad.net [88.175.212.11]) by post.strato.de (RZmta 32.29 AUTH) with ESMTPA id w05835q2O8QlwDc; Mon, 24 Mar 2014 09:26:47 +0100 (CET) From: Gregory Hermant To: rtc-linux@googlegroups.com Cc: Gregory Hermant Subject: [rtc-linux] [PATCH] rtc: rv3029c2: Fix potential race condition Date: Mon, 24 Mar 2014 09:26:38 +0100 Message-Id: <1395649598-4931-1-git-send-email-gregory.hermant@calao-systems.com> X-Mailer: git-send-email 1.7.9.5 X-Original-Sender: gregory.hermant@calao-systems.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2a01:238:20a:202:5300::5 is neither permitted nor denied by best guess record for domain of gregory.hermant@calao-systems.com) smtp.mail=gregory.hermant@calao-systems.com; dkim=pass (test mode) header.i=@calao-systems.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , RTC drivers must not return an error after device registration. Acked-by: Alessandro Zummo Signed-off-by: Gregory Hermant --- drivers/rtc/rtc-rv3029c2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index 1a779a6..e9ac5a4 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c @@ -395,6 +395,12 @@ static int rv3029c2_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL)) return -ENODEV; + rc = rv3029c2_i2c_get_sr(client, buf); + if (rc < 0) { + dev_err(&client->dev, "reading status failed\n"); + return rc; + } + rtc = devm_rtc_device_register(&client->dev, client->name, &rv3029c2_rtc_ops, THIS_MODULE); @@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client, i2c_set_clientdata(client, rtc); - rc = rv3029c2_i2c_get_sr(client, buf); - if (rc < 0) { - dev_err(&client->dev, "reading status failed\n"); - return rc; - } - return 0; }