From patchwork Wed Mar 8 23:37:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9612097 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 DB6AB6016C for ; Wed, 8 Mar 2017 23:39:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCC9628633 for ; Wed, 8 Mar 2017 23:39:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0D6D28640; Wed, 8 Mar 2017 23:39:06 +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 6532D28633 for ; Wed, 8 Mar 2017 23:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754200AbdCHXjF (ORCPT ); Wed, 8 Mar 2017 18:39:05 -0500 Received: from mail-pg0-f49.google.com ([74.125.83.49]:33168 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825AbdCHXjE (ORCPT ); Wed, 8 Mar 2017 18:39:04 -0500 Received: by mail-pg0-f49.google.com with SMTP id 25so18810550pgy.0 for ; Wed, 08 Mar 2017 15:38:00 -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=7v2cRvxrwGXe8uglhpECIUfFSFOQmLyPIDxlPXC7Iuc=; b=SCK1fDUUW0rZHgHJ1movKE8882kq2Rxi8iUpFaCIWvPC+h87QznN+TyUKCSzhqwCyW vXnKF9S847Yl7pKr+uJnUXMdJ2MzVBDQHh3pRC4qwQyDRhQ9pTbk4Tvp8vfgGHUSFO8O w7luRPFuIN2ImJrRsMoTex4u2hxFMDPnQY15E= 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=7v2cRvxrwGXe8uglhpECIUfFSFOQmLyPIDxlPXC7Iuc=; b=UFAGf9SPrMC8D7KgMh1EB2LZXxXz5hFdFxTy5CzwlIZRoQCRMR17kRs2oivmVU/YSf vaf1+Gro1tUrOO9quu7PhCxRjcF6SpA7c2Ql35DkdKood8e7aIEFTatMRp+shUVu2isB VjFOYsfyaN8d1KVWsgy/8YV0lvNI0HXtgvXub9JGIYqYKpmDeHLGRj/pUH2n4C6GafsN w+diuM/ySKXzfn2NInGPKqCsfZ8ScbMF1QUTtdDUFL8CD/1ISHb8LOLDyuxNs5fGLkJL v4dSLKeUL3z/yu1us9lG45sL2SXwVyP+vbUCtSe0PS6246w+EM8WlphMIpcwS+HFXMQc 67ZQ== X-Gm-Message-State: AMke39nFAkajGRNVPQDf2X5kQ5H4foqJ48YnhV4NkFeG/WYzaMsfWKOiHqwAP2CcFYvXDXQK X-Received: by 10.99.238.5 with SMTP id e5mr9984104pgi.49.1489016280367; Wed, 08 Mar 2017 15:38:00 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id m21sm8266533pgh.4.2017.03.08.15.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Mar 2017 15:37:59 -0800 (PST) From: Brian Norris To: Bjorn Helgaas Cc: , Brian Norris , Shawn Lin , Jeffy Chen , Wenrui Li , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, Brian Norris Subject: [PATCH 1/3] PCI: rockchip: fix sign issues for current limits Date: Wed, 8 Mar 2017 15:37:46 -0800 Message-Id: <20170308233748.54706-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 --- v4.11 candidate? 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;