Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4698406rdh; Wed, 29 Nov 2023 08:16:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDR4W28I5OEYs9YPgtK+Pb45GYkVxfK1Nco/gU1HA+sE77IRfY9tvDnnhNzc1rQecFaCQK X-Received: by 2002:a05:6a21:a58d:b0:18b:d99a:99bd with SMTP id gd13-20020a056a21a58d00b0018bd99a99bdmr23230523pzc.32.1701274600670; Wed, 29 Nov 2023 08:16:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701274600; cv=none; d=google.com; s=arc-20160816; b=AZoQ5gaktWFkeoaSr9d6kvVUVauCqTNca+e9jHcAd+Zptoc2oTKGjC+ndmmcYDyCRE JPgjoOuOdfCSSWopKcmhrMS8TKNa5itnBOuRnWnDmbHodUTBsGGPdpH9YEdAvgAN7mpu HSc6lYA5YiBUJ7fU170KjMaf1twC0UGeq9VFCBTsWIeLLHSdwcaMTYdw7KsSaXZ0w4BI 7jWtxmKPoSAMIaBLrgGnHLVVBSzKoAt33QHfDaYeKpRaRQLZ9fGrn+TjU7Yd+mJLn01H 9HMTZme4X4QPt6WjP2+kWDfZ1ENkfeNBtqMwt+x6J3NZkzZHvnqSB4zKxoMZ5bvhZXF8 bcRg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TSdgwu4Um0fPrArS43eyiDKxgk95EXRlAl/9yrQGGrA=; fh=p5qGgOuQ1qdHRKXQ3E7ZkEX+heMqfz4xi8z6J8C0/aQ=; b=dr+mLsUF2oD3veRqUBAvGeROlGDX912GL9zddsrdhF2vmkZhalmCRgA5Mbn4AQjDTg upgp+mGDkH+XPbBQfoyqWg/HRix4Ul+D29aMRLsk/wGMAtghLpNqQCNu58hGbeOIsR9l iB6871jBOViZ1Gk8v9XDKM/uf+S4sGTS2YThoVI5IRNzMi76z81/ibazMIu+q8qmEGN4 Xcq60JIuXyyOJxLOLPphrgQWpZTqUpdHzxiHrCYGBOaQ0kNkGyoRCos+gAWFcpD5lzWM dOxTd36SaUp6PUHSRJ9o7glmg8Vd3R8VJKDH6qq441SQcY5pcjgIYxhR4TC1b5s8ctnf 2Lug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EUur5zgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 30-20020a63155e000000b005c207717411si14793613pgv.864.2023.11.29.08.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:16:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EUur5zgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7A013807064A; Wed, 29 Nov 2023 08:16:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbjK2QPT (ORCPT + 99 others); Wed, 29 Nov 2023 11:15:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjK2QPI (ORCPT ); Wed, 29 Nov 2023 11:15:08 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55C7DD6C; Wed, 29 Nov 2023 08:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701274515; x=1732810515; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3uSEXFAfigJrZCoXVJ4ZtMtwaJ+4f5OEieqGUBtBbV0=; b=EUur5zgdw0sHryb1EIcaXGIhv7lpKJbDN7o0UI7pUQHeLa/tXN+km1dm g/nKztSx1Une4uuEKGQ3XTZdbhMjhiTKL2g6mUVSXkHVM1ju6C8zKixkf nmVG1mAQ+B2kRpCR6lTW8wJ4mosJyPLcn5NvVo7PSMgWC9e5wtIfv03z3 HqdHwyjErXfDMn4klYAQyPkY78GHsEp7tumdhMeRZXcs+Bd/OrtoNH9JE fUDJmmAxZzbl1AIaQ7zbz4xJFem5UBN0Zc1EbvvQTJ3Qbs/dYD0W+c/jt myHumjktzAyxKU5ARO/Hl7dNfaB9bIvCGOPvoQMcYaLBVlD9fVLUT5UMi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="373372556" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="373372556" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 08:15:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="892498853" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="892498853" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 29 Nov 2023 08:15:02 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4E6C2968; Wed, 29 Nov 2023 18:15:01 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rasmus Villemoes , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Krzysztof Kozlowski , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Geert Uytterhoeven , Biju Das , Claudiu Beznea , Jianlong Huang , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, openbmc@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Ray Jui , Scott Branden , Broadcom internal kernel review list , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Sascha Hauer , NXP Linux Team , Sean Wang , Paul Cercueil , Lakshmi Sowjanya D , Bjorn Andersson , Andy Gross , Konrad Dybcio , Emil Renner Berthing , Hal Feng Subject: [PATCH v4 03/23] pinctrl: equilibrium: Unshadow error code of of_property_count_u32_elems() Date: Wed, 29 Nov 2023 18:06:26 +0200 Message-ID: <20231129161459.1002323-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231129161459.1002323-1-andriy.shevchenko@linux.intel.com> References: <20231129161459.1002323-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 08:16:32 -0800 (PST) of_property_count_u32_elems() might return an error code in some cases. It's naturally better to assign what it's returned to the err variable and supply the real code to the upper layer(s). Besides that, it's a common practice to avoid assignments for the data in cases when we know that the error condition happened. Refactor the code accordingly. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-equilibrium.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index 5b5ddf7e5d0e..54755b583d3f 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -715,12 +715,13 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) if (!prop) continue; - group.num_pins = of_property_count_u32_elems(np, "pins"); - if (group.num_pins < 0) { + err = of_property_count_u32_elems(np, "pins"); + if (err < 0) { dev_err(dev, "No pins in the group: %s\n", prop->name); of_node_put(np); - return -EINVAL; + return err; } + group.num_pins = err; group.name = prop->value; group.pins = devm_kcalloc(dev, group.num_pins, sizeof(*(group.pins)), GFP_KERNEL); -- 2.43.0.rc1.1.gbec44491f096