Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp602219pxm; Thu, 3 Mar 2022 00:20:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZith39P+0P6MYvxxGMTfdqzgTS+fCpipbSxK2VOSPIfgbbHoYTAoN+7XRpI9llFDZSbra X-Received: by 2002:a50:e1c9:0:b0:415:c78e:fb4b with SMTP id m9-20020a50e1c9000000b00415c78efb4bmr4513146edl.21.1646295616125; Thu, 03 Mar 2022 00:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646295616; cv=none; d=google.com; s=arc-20160816; b=MzQHmVx7HyUTYMXh1gYruIMaiBCA4ivzDQCu37KGHrjSZsMWprytOPCdJLb7Shd+Nx nPGns5vFEYqnFG+PY5jQjlUuwAcKiBgjPAu1SdbHbCxpDJMES+E+doiOdUJ0I0qwijIc LjihsNwZkWgqDCHR/0jblP7WcE7ufd+eXkzFUxLgmT0bNXC634naN5DT8SBPKtSsqcis ygZMDjc2PGvybfIBz9T5OZn+yrTMFbLP2nE2XFU5Hfq27VfrCNqJgMVaiSvkIRYPu1DQ JakczVn2LfDCSXHx1RwwLnzbL07EPB9UCW8Wh3zRUHTLzPNGdrhiVQ5Ihg1dxeCDE6o/ WsUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=Rm8wE57tI3XM2j9t7IiB5mHPLBfR0D72CV0xIDqe/+A=; b=L9urV4gCcdRlh3cFraRzhIc2QRMe3cDIZpGnm2tTDjkgK3iy0+UuGXhUHHoL5Aiwwi CWRhR7PNTsMUx5plAI5ywCH7vHXc7Is8scScQ9YKh2piRXNPy/WsqwPh/magROhpM3aQ 5X4U2Sv0fFP9v5srfBLxOn1Qq8F9ung9Ihu99+vpzzzPEg1+wUmYGd8VC72XdJpMyEi6 s4GmpfDOs86nSRnT+DSACCHJ+F0m0VoBIZf8WjrnMR3QiQKIgHEIY0pic6tM47GHsP67 ib0KBaaZev97FV9mio99kG0ZWLgHzaRcnl9VWg24SfUnlPccOCr7s+JYcst3VNdi95sl EsCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp10-20020a1709073e0a00b006da655e1a9asi1038845ejc.204.2022.03.03.00.19.53; Thu, 03 Mar 2022 00:20:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230454AbiCCID0 (ORCPT + 99 others); Thu, 3 Mar 2022 03:03:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbiCCIDY (ORCPT ); Thu, 3 Mar 2022 03:03:24 -0500 Received: from smtpbgsg1.qq.com (smtpbgsg1.qq.com [54.254.200.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DBD6100B for ; Thu, 3 Mar 2022 00:02:32 -0800 (PST) X-QQ-mid: bizesmtp70t1646294533t7gdvkex Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 03 Mar 2022 16:02:07 +0800 (CST) X-QQ-SSF: 01400000002000C0G000000A0000000 X-QQ-FEAT: rn/rQ7Qm5gXNw165vUDyUK9zHAQ88wOFHpozS3Lroq74ASFiOMJS8J86lw9gQ YN9M0Q3sS8X2HFcji9yAWp44+0/tutHqM/dCXxg5jub9IirSt2YbjW2ltxxBzNegyJ0Pyob blyxyDzCRl5ycdVRkTgqe/B4FM6brcPHQVwA/7nGG6LqeLGtJoW3y1X+8k45IKptySPJ2qh FcSMRAdzhAkvl+CPVr1AqSMpUj4bHMhg0hhA3LpPsKsI1gFSw+gL8CmWF7hXusymYGRFCWf oV2JXtvUjrELZuUXEj7L3FoPridtasMBbfgJmOClAoLGCoR4YSZRrXg0Fa4Z1bJt/Zi5nhf Ps/mhlyXWzuTD3O60gI2qZ/OxfArbb5+hHXgKDjVNx7ERElGus= X-QQ-GoodBg: 1 From: Meng Tang To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Meng Tang Subject: [PATCH] pinctrl: berlin: fix error return code of berlin_pinctrl_build_state() Date: Thu, 3 Mar 2022 16:02:06 +0800 Message-Id: <20220303080206.16463-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign6 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When krealloc() fails and pctrl->functions is NULL, no error return code of berlin_pinctrl_build_state() is assigned. To fix this bug, ret is assigned with -ENOMEM when pctrl->functions is NULL. Signed-off-by: Meng Tang --- drivers/pinctrl/berlin/berlin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index b17a03cf87be..a073eedd71aa 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c @@ -233,6 +233,8 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) pctrl->functions = krealloc(pctrl->functions, pctrl->nfunctions * sizeof(*pctrl->functions), GFP_KERNEL); + if (!pctrl->functions) + return -ENOMEM; /* map functions to theirs groups */ for (i = 0; i < pctrl->desc->ngroups; i++) { -- 2.20.1