From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B302C1B08C for ; Thu, 15 Jul 2021 11:49:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F2A261396 for ; Thu, 15 Jul 2021 11:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbhGOLwZ (ORCPT ); Thu, 15 Jul 2021 07:52:25 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:15020 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbhGOLwY (ORCPT ); Thu, 15 Jul 2021 07:52:24 -0400 Received: from dggeml759-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GQXdG5h0jzbcPV; Thu, 15 Jul 2021 19:46:10 +0800 (CST) Received: from [10.174.178.165] (10.174.178.165) by dggeml759-chm.china.huawei.com (10.1.199.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 15 Jul 2021 19:49:28 +0800 Subject: Re: [PATCH] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() To: Zhen Lei , Tony Lindgren , Haojian Zhuang , Linus Walleij , Manjunathappa Prakash , linux-arm-kernel , linux-omap , linux-gpio , linux-kernel References: <20210715064206.3193-1-thunder.leizhen@huawei.com> From: "weiyongjun (A)" Message-ID: <55d02087-e2c7-9a0c-e20e-ff6f106703a3@huawei.com> Date: Thu, 15 Jul 2021 19:49:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20210715064206.3193-1-thunder.leizhen@huawei.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.165] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeml759-chm.china.huawei.com (10.1.199.138) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which > is the same as that returned in pcs_parse_pinconf(). > > In addition, I found the value of pcs->flags is not overwritten in > pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this > check to the beginning of the function eliminates unnecessary rollback > operations. > > Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules") > Reported-by: Hulk Robot > Signed-off-by: Zhen Lei > --- > drivers/pinctrl/pinctrl-single.c | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) > > > npins_in_row = pcs->width / pcs->bits_per_pin; > > vals = devm_kzalloc(pcs->dev, > @@ -1212,29 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, > goto free_pins; > } > > - gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); > - if (gsel < 0) { > - res = gsel; > + res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); > + if (res < 0) > goto free_function; > - } This change cause 'gsel' not set. Do not mix this cleanup with bugfix.