From patchwork Tue Apr 17 09:30:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10344625 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 3A69960216 for ; Tue, 17 Apr 2018 09:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21A0428A31 for ; Tue, 17 Apr 2018 09:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1390128A34; Tue, 17 Apr 2018 09:30:42 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A00F28A31 for ; Tue, 17 Apr 2018 09:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=YJJGS8KwKjekd+pZLX0T+4dvKgxFVMbWDrzzpcofCWA=; b=oJ5 kGWdxwgdSB8kKFW7J0vtkDyiInI/uAl1MRWel6UfN1vVEL0fFak0gS0UY98ZkX9Xsi0ZeI3tdukaP 9mOq8MlSFgSlgdryaZH0IGelOYASBC/+CpzqX3LcFtDRzUODtl4hqCo0CRZjDCElrBfOfsyGUAkmA sa1mc/RTXG8xZQ3hNknWE2wpIe9o5imEcuuok1FH+6b197gYxqZY2BHBBHCoX5ozkV59hBEVrojeX betU9IehGTWBRMGWh9kX5/VM5rOZuvow8vPElYLSaeWSTr5mNxAxySIFkJPDXGWcnGaAN/lpiv3Kp vgMCq0UVF6X+gUtzvdo1M0whQsFy+iw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8Mwh-00061B-Le; Tue, 17 Apr 2018 09:30:39 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8Mwe-0005z6-VP for linux-amlogic@lists.infradead.org; Tue, 17 Apr 2018 09:30:38 +0000 Received: by mail-wr0-x242.google.com with SMTP id q13so30092619wre.3 for ; Tue, 17 Apr 2018 02:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KB/9cHaLL6rRgcFOgl7FO/H2LwslTViFXLxBX2W6S/c=; b=STh+UJXlqizKedE/T+d+VgImu1of4P9JonUA0jftKmk1jDdF1UZL/ifbS34QUVTjiH ypvW8PnEunOhK+eygqJc5MbD2wtKjaT+BddJa5btCSiIbBDApEQWaFD1ERj/6PV6Tfp+ ghTr+RSuK/kIzBjQehh/fkledxGvtreLHt8j4bRLNPL6wU7Gz3n195oa30oXyJQmMcmv DDkwGFRJXhgO2qOrlJzEAy6+9dcNzOyudd088zk7Lz2+SFUYvPPyxFQCXYjyLHW/dOlj 08XRMxPu38VABJDqCrUsiG/cPNa6vQJ2qk+Pcpd2qVDbzXis6UFrV9C0sGciYvCEHS1W m1Og== 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=KB/9cHaLL6rRgcFOgl7FO/H2LwslTViFXLxBX2W6S/c=; b=Aw6vMB4SJ3HDo1pA+65c9b2HS1e+F8whNvCSH3FoyJGuXYa3O3/qEA81zGNiKVjJEJ L/qxbxmbMobwaosn+mDAAKvN1f7r338GLAQ/vWG4SG5CBO89R7pW0QqkdzsdN1+pHKFy VexLZSwmteQzKk276IbgY3Uel8gzsmoVEUD//6BQlecXxiRXNtAMSxaDYQdis1mQVnCY 73QfwTRuNteY9XSj1y4i/7esCpR1yPuEuQok9An+p9csgrA9ccV9HyXRMOp1MfVKuhCK 3+3+hyAKX/rFncBXF1Ck9WsAUKEqyAQiYftYJ/pYpzQktKOYtz2mxGGYioJzyZz7G+2j W1jg== X-Gm-Message-State: ALQs6tDuvXfsMTzcXY25+MiDIjSQBv+/N4FbAm5A67YgmsjlvDn7OZpx CL4J7cgHgpcM+74EBS5JnimlqQ== X-Google-Smtp-Source: AIpwx49DTPgKJNRvAhHWxhS1SdNon7GL8RPHUD68JOKetXfJTlW8PCjholHCYy2VIVz1767Kq5hzsg== X-Received: by 10.223.157.65 with SMTP id o1mr1023028wre.14.1523957425127; Tue, 17 Apr 2018 02:30:25 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 39sm24396124wry.89.2018.04.17.02.30.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Apr 2018 02:30:24 -0700 (PDT) From: Neil Armstrong To: trini@konsulko.com, u-boot@lists.denx.de Subject: [PATCH] reset: fix reset_get_bulk when phandle error Date: Tue, 17 Apr 2018 11:30:22 +0200 Message-Id: <1523957422-16552-1-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180417_023037_079996_33C9E303 X-CRM114-Status: GOOD ( 10.67 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, Neil Armstrong MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes the Coverity Defect CID 175348 when dev_count_phandle_with_args() returns a negative value. Fixes: 0c28233903b5 ("reset: Add get/assert/deassert/release for bulk of reset signals") Signed-off-by: Neil Armstrong --- drivers/reset/reset-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c index 9a5c9c9..fa4f653 100644 --- a/drivers/reset/reset-uclass.c +++ b/drivers/reset/reset-uclass.c @@ -88,8 +88,8 @@ int reset_get_bulk(struct udevice *dev, struct reset_ctl_bulk *bulk) bulk->count = 0; count = dev_count_phandle_with_args(dev, "resets", "#reset-cells"); - if (!count) - return 0; + if (count < 1) + return count; bulk->resets = devm_kcalloc(dev, count, sizeof(struct reset_ctl), GFP_KERNEL);