Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1168756pxf; Fri, 12 Mar 2021 03:41:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGRQ4p1PUkEWPEmUD/el5q9JxZtmhsco4DYkJuCSWfpv9nt0gz60Vv7nB5VGvO1PM8YBrQ X-Received: by 2002:a17:906:23e9:: with SMTP id j9mr7812483ejg.78.1615549319606; Fri, 12 Mar 2021 03:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615549319; cv=none; d=google.com; s=arc-20160816; b=CVTOFIi9yGkRWhNOHZktGfp8xJlGgkeUuB7BPYz+lGs2bDqYr0fO8SyqFM+xQTAyc5 rA2XaxUl4sNzK7d05lkj6DJ9nN8osh2I22HauVq5NN2SR8MxAkQ3pLpvc3qm0WXto8XJ 3Jag63mcGRLhVUpW7YcgjyG+o2yXnu20RjF+WJNg46Jquob99Xe5NZ6CqliMkqWh4sTg jKIFJTMAC3OthIBCRL8Hs2jhQacDxJyQwMypapBhoTypql3Jq4PTdoJkh7oQt04HFAdj P9nI/krL5NLLxxNG/4MFndf+558UX2JCOhfQEJgO6hVrGAReeZ8m1efu95IVd76xZcvZ D+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=85FTr8CtWZi7ZTbKGT7x0/typLYu/sxAfnMblivg5KA=; b=huJ9NSIWXQEx5HYCYICOf0xhE4sYwdnA3yKV5keOySBA3TkR+r+9GIGSNM4pwRlJ8b btSYZfPRbDs+NnnVSdPxEE9pUlhtyQDLW0sR9UjOsKIaHem/RwI2FEN66Ig91Ii2m7dq zXPycuyk1+n1Hr4IicnRZsybyaBhmcLmpCPYmMsdkGU1S6YF5XCPd0/6pE/LZma3TbAr ZW7o52SNL+Rkg/rwqHWNDwKzATgRJXprUgJn61QUMPaGhq0hByjPk0zzGDjYMAQJ2UAq 8O8/YfT+SEz/2yZndvOXSoEpPZwD1oIgQExLfVxL4oB1GEqbJgrY7ZBMqCUht6GVQGds UH3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=his6owhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si4097324ejt.685.2021.03.12.03.41.37; Fri, 12 Mar 2021 03:41:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@monstr-eu.20150623.gappssmtp.com header.s=20150623 header.b=his6owhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbhCLHbw (ORCPT + 99 others); Fri, 12 Mar 2021 02:31:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231620AbhCLHbl (ORCPT ); Fri, 12 Mar 2021 02:31:41 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93011C061761 for ; Thu, 11 Mar 2021 23:31:40 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id z1so6549907edb.8 for ; Thu, 11 Mar 2021 23:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=85FTr8CtWZi7ZTbKGT7x0/typLYu/sxAfnMblivg5KA=; b=his6owhZa67rd6+8ImNixx8KFUBCqUHledGahWGFtejo2HliAv4AwHeShz619wuPSa PPXwLSeBYsnD7NNHganXwlqztk8SIKPl+UU0sw7YFh1ehUy6p6y+T+IXxCBvtFHxhYfN px6B93b/Lk2lVNAI1kIlEhXxRVgrdPwWfiWZBvIXNF0FBwoPWD/YY3UhtBwXAdzErc3P MK93j0pL6zaChQRp19UQ8n4CTFM9SjduSsQ/lmvDU0erVUsfCC9jCC9jqL4VNW/9r4Gs QAQ7ltWBzWeOFQSR0vrcpTHHnWtcSUtxTKGFzN+0+YiZwsPadphR0emWYbmQOEVEDAUO jcaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=85FTr8CtWZi7ZTbKGT7x0/typLYu/sxAfnMblivg5KA=; b=JF5oRvv2SV0QHTaAHRBdDmmQGomclBmUiO+nbI8cu1I9sWVu+xDxSUPGVNMjE2LfOZ /wXltS+0r874GwWD5/wdx162nMIPefWy0t/7SilF8lEzxhB+jj/HXRrORihWIYar05sX y2T7HTRj+KZhnZqtlO3KbtN1JbG1piXXddrkm3LmHrLFCm4DdGKNhyrsldtMpBIRQzuG FbjkolErE7wfmXt8wDrsE13nUTC1Wgch1fcwLF2LBFbH1iOMP8C7Z7uRnWJp5R9D8Kuu ChOeV5xlKO+EEdUWW3z9WPtMTv+rhpvlQ6b9KyQokw/qrhrqGKDnsrVRVO4tF6qWhowP vR9A== X-Gm-Message-State: AOAM530pwWCPDBNhwPIuKcAFwG5OnAXuIzj1LQPu08f3dJLGKA3XXwZ/ XFqzU4JK6V5cObIF+g1EIeH3XulvVdgVcp+M X-Received: by 2002:aa7:cd0e:: with SMTP id b14mr12862709edw.354.1615534298928; Thu, 11 Mar 2021 23:31:38 -0800 (PST) Received: from localhost ([2a02:768:2307:40d6::45a]) by smtp.gmail.com with ESMTPSA id l18sm2326832ejk.86.2021.03.11.23.31.38 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Mar 2021 23:31:38 -0800 (PST) Sender: Michal Simek From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu, michal.simek@xilinx.com, git@xilinx.com, Linus Walleij Cc: colin.king@canonical.com, dan.carpenter@oracle.com, linux-gpio@vger.kernel.org Subject: [PATCH] pinctrl: core: Set ret to 0 when group is skipped Date: Fri, 12 Mar 2021 08:31:34 +0100 Message-Id: X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Static analyzer tool found that the ret variable is not initialized but code expects ret value >=0 when pinconf is skipped in the first pinmux loop. The same expectation is for pinmux in a pinconf loop. That's why initialize ret to 0 to avoid uninitialized ret value in first loop or reusing ret value from first loop in second. Addresses-Coverity: ("Uninitialized variables") Signed-off-by: Michal Simek CC: Colin Ian King CC: Dan Carpenter --- drivers/pinctrl/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index f5c32d2a3c91..136c323d855e 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1266,6 +1266,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) break; case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_GROUP: + ret = 0; break; default: ret = -EINVAL; @@ -1284,6 +1285,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) list_for_each_entry(setting, &state->settings, node) { switch (setting->type) { case PIN_MAP_TYPE_MUX_GROUP: + ret = 0; break; case PIN_MAP_TYPE_CONFIGS_PIN: case PIN_MAP_TYPE_CONFIGS_GROUP: -- 2.30.1