From patchwork Wed Jul 16 08:18:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 370631 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 594D3140082 for ; Wed, 16 Jul 2014 18:19:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751673AbaGPITC (ORCPT ); Wed, 16 Jul 2014 04:19:02 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:38273 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbaGPITA (ORCPT ); Wed, 16 Jul 2014 04:19:00 -0400 Received: by mail-wi0-f180.google.com with SMTP id n3so842807wiv.7 for ; Wed, 16 Jul 2014 01:18:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=72tOnrT26N5iJv85yVVPm6Iq6r1pnFOEmIzrFDJRius=; b=Sb2c+SDzBQkiOVpmYP6+XtJqO9Y/5r18RETSA3wgUPoNL4G/HIOFE5BzcI9uGe6ghb rFI+k3C/2MKqPh98lDQzw97u4CuLdf4NNPrWzXmfMUWNDtL5oQqwQVuvvvxaHKhTe+Cn NiwRHnr/TtxXebbEQN7ZuSjk7yfMtcK+vzx1x4L5VFXh8V8R9n8a5mlcXciL2g7ostIa MkKKgyLl0/rnKXlTioDnVKKULJKncVZIVCKzA0BBcIdglVfm5MHuNaEUh01noDf6WQ4h nrST5JIvathXWN79Bu5ZDkMCSS6eTXy7eqmSsKUtVZpdPpG7m4FPlMOKWoRF3vAe5KSs FGaA== X-Gm-Message-State: ALoCoQlMllVVGtkFCLQVXvlTuBXVXfvVS+6wQWLrdgyu3E5c28euZH+fWdKztfRYBahPHtdR7SuS X-Received: by 10.194.23.135 with SMTP id m7mr34055429wjf.2.1405498738538; Wed, 16 Jul 2014 01:18:58 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-99-226-247.as13285.net. [2.99.226.247]) by mx.google.com with ESMTPSA id eh10sm6227810wic.0.2014.07.16.01.18.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Jul 2014 01:18:57 -0700 (PDT) From: Srinivas Kandagatla To: Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-ide@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] phy: qcom-apq8064: fix possible timeout without check Date: Wed, 16 Jul 2014 09:18:43 +0100 Message-Id: <1405498723-10681-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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 --- Hi Kishon, Just to make it easy for you, am sending this change as a seperate patch so that you can apply it on top of linux-phy next. Thanks, srini 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 c9b4dd6..f91e254 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)