From patchwork Fri Mar 10 02:46:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9614533 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC1C9604DD for ; Fri, 10 Mar 2017 02:47:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C14B0286E7 for ; Fri, 10 Mar 2017 02:47:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5EF2286FC; Fri, 10 Mar 2017 02:47:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AADD0286ED for ; Fri, 10 Mar 2017 02:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926AbdCJCrS (ORCPT ); Thu, 9 Mar 2017 21:47:18 -0500 Received: from mail-pg0-f49.google.com ([74.125.83.49]:34306 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067AbdCJCrR (ORCPT ); Thu, 9 Mar 2017 21:47:17 -0500 Received: by mail-pg0-f49.google.com with SMTP id 77so33321312pgc.1 for ; Thu, 09 Mar 2017 18:46:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=cO2lB+S3DOQb/rjpwYYpIDFCVL6H+Meu3OAIlxJW+ho=; b=KvrqtRvnzjk0MXmwwafklI22da7Liw8hzd4q/r4cpyNJuDWVi/5NbygqT/BL/VM0N2 wMxFMTZyZoeVKJE3p7eOGVFbJO7Ad0MjQb4qqcZuYYiR4j+1Y19PS4hS1P8hY9A0bSdS ElbhQkAboFbq5vOWuWT4t3kEhrItw36QvolR0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cO2lB+S3DOQb/rjpwYYpIDFCVL6H+Meu3OAIlxJW+ho=; b=Gcs6L1V/V0qzM1DmlH8c8TMk80asc2buvIJNwO4djjtdXRS8BNIFxmmUlPr5b52VMs 0oYFSnKPqt5tv13u9419/SIgor4ZkdgON97UTaYD8vIf9ZCH4dSSHGVE010HR6ON3mxf tyexhRPFK6uAFsTv/FWeDgGE1/lP/26DgwUZpOC/jKUo7RMq4ZfYgbWk3TdHq7SfJPTc 2gjfUW1uhKaOHuPTkRtlEtizH5WjMHev64hlTNZYOibDLDi81NpnUxbKLwehDGa4S1Fg gcKDw6RQfrz+y5ZbMD5qB8Iye+BgT3bTod1p0huy2V0S4PT64UjvbFrmEucim4/o1fxy ptpQ== X-Gm-Message-State: AMke39lPVoMu4Lewh1OoexQu7f+gJjLxnpSuE9dnQEVrWO3DtqBr6jRPf8ST9Qo+iPZuR55n X-Received: by 10.99.125.23 with SMTP id y23mr17671407pgc.79.1489113989117; Thu, 09 Mar 2017 18:46:29 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id w29sm14830573pfi.131.2017.03.09.18.46.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 18:46:28 -0800 (PST) From: Brian Norris To: Bjorn Helgaas Cc: , Shawn Lin , Jeffy Chen , Wenrui Li , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, Brian Norris Subject: [PATCH v2 1/5] PCI: rockchip: fix sign issues for current limits Date: Thu, 9 Mar 2017 18:46:13 -0800 Message-Id: <20170310024617.67303-1-briannorris@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The regulator framework can return negative error codes via regulator_get_current_limit() for regulators that don't provide current information. The subsequent check for postive values isn't very useful, if the variable is unsigned. Let's just match the signedness of the return value. Prevents error messages like this, seen on Samsung Chromebook Plus: [ 1.069372] rockchip-pcie f8000000.pcie: invalid power supply Fixes: 4816c4c7b82b ("PCI: rockchip: Provide captured slot power limit and scale") Signed-off-by: Brian Norris Acked-by: Shawn Lin --- v2: add Shawn's ack --- drivers/pci/host/pcie-rockchip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c index 26ddd3535272..d785f64ec03b 100644 --- a/drivers/pci/host/pcie-rockchip.c +++ b/drivers/pci/host/pcie-rockchip.c @@ -425,7 +425,8 @@ static struct pci_ops rockchip_pcie_ops = { static void rockchip_pcie_set_power_limit(struct rockchip_pcie *rockchip) { - u32 status, curr, scale, power; + int curr; + u32 status, scale, power; if (IS_ERR(rockchip->vpcie3v3)) return;