From patchwork Tue Jul 22 10:56:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 34046 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 334AF20540 for ; Tue, 22 Jul 2014 10:58:16 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf65035774pab.1 for ; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=l87DhFb/HOpZCJW+QRkC+/ql7jd4JrpLbFm526bAGwA=; b=hGZYKmV8aNgjvW/ibe0/1t2+f44FmgQcBvbb50XVDJJTv3GzJBYEEnPmYLl0cMJGFY mM4h3Wb6ybZkRNttXfiKhDz3ciMjXUXfP3LZIS66gxdU2gpBaSJ7TAN6lhvxHJUb5WkA BU0EUUe875/RW6r9TMm4SsNCTun3O1Vj8eu9RL+J3f+Fu59NAFwiALKnG+F0zTFKv8gh XcQJmRxRH8ti0U6JdjIto8ne/35pUrj0XB2USPB5j0D49i7ii6OHZnd3uZ6qNixSEOed XikevDiNNdN4ywDBTkWx+cbTvvyL5np/iWpsIJMuoYYd4dF6pSYdB/pDO36VWKEapnlV rQMg== X-Gm-Message-State: ALoCoQn/d+SB8mh1jb1hICBc1ThP9fTKZeo4lSP0iB2dEbs4WfEZOCts3mNrQGVidZCShM1PlI8N X-Received: by 10.66.148.101 with SMTP id tr5mr1989900pab.10.1406026695344; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.55 with SMTP id a52ls2287674qga.14.gmail; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) X-Received: by 10.221.26.71 with SMTP id rl7mr11568931vcb.69.1406026695177; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id q19si49310vea.10.2014.07.22.03.58.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jul 2014 03:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so9757071vcb.35 for ; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) X-Received: by 10.52.248.146 with SMTP id ym18mr32865191vdc.8.1406026695083; Tue, 22 Jul 2014 03:58:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp185683vcb; Tue, 22 Jul 2014 03:58:14 -0700 (PDT) X-Received: by 10.70.55.229 with SMTP id v5mr10464718pdp.145.1406026694040; Tue, 22 Jul 2014 03:58:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dn2si8668784pdb.500.2014.07.22.03.58.11; Tue, 22 Jul 2014 03:58:11 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754945AbaGVK5v (ORCPT + 12 others); Tue, 22 Jul 2014 06:57:51 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:46593 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753576AbaGVK5q (ORCPT ); Tue, 22 Jul 2014 06:57:46 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6MAvj6G022963; Tue, 22 Jul 2014 05:57:45 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6MAvjFq018899; Tue, 22 Jul 2014 05:57:45 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 22 Jul 2014 05:57:45 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6MAv7r2027221; Tue, 22 Jul 2014 05:57:44 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 23/28] phy: qcom-apq8064: fix possible timeout without check Date: Tue, 22 Jul 2014 16:26:46 +0530 Message-ID: <1406026611-30493-24-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406026611-30493-1-git-send-email-kishon@ti.com> References: <1406026611-30493-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Srinivas Kandagatla This patch fixes a possible timeout in poll loop without actually checking the register before return. In theory the there is a possibility of loop being scheduled after a long lock/delay, which would then force the loop to exit without actually checking the register. Reported-by: Bartlomiej Zolnierkiewicz Signed-off-by: Srinivas Kandagatla Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-qcom-apq8064-sata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/phy-qcom-apq8064-sata.c b/drivers/phy/phy-qcom-apq8064-sata.c index d7c01aa..b3ef7d8 100644 --- a/drivers/phy/phy-qcom-apq8064-sata.c +++ b/drivers/phy/phy-qcom-apq8064-sata.c @@ -91,7 +91,7 @@ static int read_poll_timeout(void __iomem *addr, u32 mask) usleep_range(DELAY_INTERVAL_US, DELAY_INTERVAL_US + 50); } while (!time_after(jiffies, timeout)); - return -ETIMEDOUT; + return (readl_relaxed(addr) & mask) ? 0 : -ETIMEDOUT; } static int qcom_apq8064_sata_phy_init(struct phy *generic_phy)