Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp34224imm; Tue, 22 May 2018 13:29:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrpTtEHTUuMubWIeLGe62AAN40RZLBlADPVCo19yD5hKSliGhJs7fxn337qOrbYBpDRTPYr X-Received: by 2002:a17:902:7601:: with SMTP id k1-v6mr25895302pll.200.1527020997773; Tue, 22 May 2018 13:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527020997; cv=none; d=google.com; s=arc-20160816; b=WSu8RXkXbu8udktXX+GInbsjay3lxXCkLN+y8tyrdRzckSu0Zws/L5jpCNpTojvrx9 JxXoNh7uobaDIdeAkuiNVmSwsBXd2Im3bsHDzeQiMHmhh3OnBz15U/Vyz6znEOyHp/vo 7DT8atOu+WetMGqCIctj8qkApw9x86NovRdLFtztSrbU29zraqDSCdMaCy/mK8R84aDa bx+5gXH6+T5TV5g/XpAe6QDsi0k+WG70Qw9UyByS1NWmw3DY4PmMf6s/RwEDccD4QjHU QzQ/IaRnxASi4p6IlOaO2AczQCxBsWgnkQ1EmHKiqJce1gNFw9HRVKZVolSqg+n3GfdS xKfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=f6jTb1FW+EtHzcQncRIgJMzhMNqZSddhyS7GuMQCHJ8=; b=M1fODKTfMEr/8q+Won/iUCQ33ndYvGeP1offB8SAZhPha61oJQD/Z1tHEGU/63M7Pk MJT94uhZhBE/CWhhPA1Peqijow2euDDn39Q0hwA/xHj8nlwM7lGGEeeTlQpv+FxS3woB IYtc12hvKi7bkJZwDe3lsQd5ThRoTPILnbBiHXHewUKkWrPnvYWNJzo0jymhrZ5vEyKQ gxO3Gn8ZhAcx+wRSJ7mVIQkA2o9bQXLyOM6ra7v/eHb7EG5fyf83hF7nUZCrSgHdJaCa y71A8OYVu71GFJFHSHB6C/CavjqOvK8NyQOqVwZ+t+VPjZCtQXAIWu7ngyfWu0LJoOM1 JS8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jUViGvS/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si17442487plp.515.2018.05.22.13.29.43; Tue, 22 May 2018 13:29:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jUViGvS/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752813AbeEVU3X (ORCPT + 99 others); Tue, 22 May 2018 16:29:23 -0400 Received: from mail-qt0-f180.google.com ([209.85.216.180]:33477 "EHLO mail-qt0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752370AbeEVU3U (ORCPT ); Tue, 22 May 2018 16:29:20 -0400 Received: by mail-qt0-f180.google.com with SMTP id e8-v6so25251645qth.0 for ; Tue, 22 May 2018 13:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=f6jTb1FW+EtHzcQncRIgJMzhMNqZSddhyS7GuMQCHJ8=; b=jUViGvS/9p2n481ifX1ndiAwmll6pcphXoH8jzgXIw0AKoNVVFOtMWpt0qhjkYSfZn 5zRwSPgSSD/zJPEgTGclRXmmdVKff3NBlG3FVz+32nXMxL8xKOUYpWy3lHj9e9D9CZBe 0cD2+4Fv97IfvbhTvyd88Jfwn0i+kL4Fg0mNm9r/2TU3f4mY93MMJ9DAK+YoWZ8ccJxn riQVGkYJwKoLlfNKeAnEQNFlM5aBuPha+YWq+B9UT3uNkVurWbezWI8RhZJm2ZS/BmfE UZ+nTqSS0eK4DJ6j6xth7I4gZGqUVK76vR7P+3jaqAmCtB4yzLCGdSu84DMYRC/bhPQo nKAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f6jTb1FW+EtHzcQncRIgJMzhMNqZSddhyS7GuMQCHJ8=; b=laNm68TR6E/J5rx2XAGLX2S3+73t2N7hAOe3BO243N2e2Cu3Vqk8qj91fnVWoK3LEj 6ngbRctpm+STbxhxBXtis2jGiAPiq2LFWT1yK7Q6uZpohNWfCd+N1q2lHqhZORs9AbCT ZDdElgN8qUSfqh+amwIaAhieBpHjJ1RyZZcITNgMQT2RnPzRBGZ0naoqh/KAju91cWIS 5A5tQZONp4K006nRYwDpKlI+E8Pa2S8LlGJqFv2BFYer9lywrTrAa12QePTVEr2Xx1tA kgk/DZ/LdQkNMBKSzTUiXPpd3gQg9ctpJqUQ988cuZlxKfmGojwMgGGgAaN4kM0cEabQ 75ew== X-Gm-Message-State: ALKqPwcslqTtSRftRQgQ5Fdi+ejkFXYi9pRyCnRmB5D+PlSa2frMALT1 yZUPRP3zc4EZ1tgbf8GVs/5LjQoDVkOP/loetXYXWQSZ X-Received: by 2002:a0c:ae2f:: with SMTP id y44-v6mr23627469qvc.157.1527020959425; Tue, 22 May 2018 13:29:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9896:0:0:0:0:0 with HTTP; Tue, 22 May 2018 13:29:18 -0700 (PDT) In-Reply-To: <8a7108ce-a109-a1b5-ace7-38a189d2352d@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-28-git-send-email-xieyisheng1@huawei.com> <8a7108ce-a109-a1b5-ace7-38a189d2352d@huawei.com> From: Andy Shevchenko Date: Tue, 22 May 2018 23:29:18 +0300 Message-ID: Subject: Re: [PATCH 27/33] sched/debug: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , Ingo Molnar , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 3:10 PM, Yisheng Xie wrote: >>> + i = match_string(sched_feat_names, __SCHED_FEAT_NR, cmp); >>> + if (i >= 0) { >> >> Why not >> >> if (i < 0) >> return i; > > if i >=0 it will also return i. so need return i just if (i < 0), right ? Looking to the only (modified) caller, I think yes, either you return error code or just 0. >>> - if (i == __SCHED_FEAT_NR) >>> + if (i < 0) >>> return -EINVAL; >> >> Now it would be >> >> if (i < 0) ...even if (i) and rename i to ret to show the change in returned value meaning. >> return i; > > Right, will change it in next version -- With Best Regards, Andy Shevchenko