Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp797960imm; Mon, 21 May 2018 14:40:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoOXROk0OVJNydf0WzkseSHoNQzoFqlt1VafV4TV4mNPBRwBrweD8S3whatY6AoYIuA3kng X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr21940749pli.199.1526938820787; Mon, 21 May 2018 14:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526938820; cv=none; d=google.com; s=arc-20160816; b=EEhuhYxMlNV3uXQRI+s+h7wnaeb7JY4Kow/M/2ke+0k+mER21KYwwsZr01BULRXPba cdIPFvxs7toeO9SVZvealHocGGUykUlSrX261JNVHl+29IIM9oBOyMDNxvwJNv1Uamvm YYAJ8GbKTEGIZS5djSO0x5hFmEcdALWoOUO/IniePLRI8F5ZCghe7eQoZSex4N2fUnFC r7b1deBZSnMF5Ne9hCzl9IgvqLi1QxWdXgPt+uPFPO95U6lGinxMwXym72O2YUs5DwcO AyoZJQn67dfU+ZB8AxH1ujeWaEri7odUz4jVp2zsQ/nZR/7/9vIVWpvNy5OcV5pEwEet mw+A== 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=q3eOdNWKnpc76XfNV8qnuPTBJFJUa+w7kbZdFsNZ34A=; b=FHN8As5/dtoYYrHoecgcIG3Z2rRYOUY/Ws0Nc12Wk1x8NEq7ViWHCLPKqoc5OcaleM Wlq1bWReHVtB2xTnBoV6baDiAQu28Ld54Kd1y2eF+HFRGo8kxPIJpgwbXgh8bPsHcZry iaLL9DP5l5ZcLV3tpIyrgSB9gzXF30rZ1ZYpxfAgDypdRZyR6mliHh4BMu6Ls0tpGWew BPNmFH8+4hJvuyH4ixWevTZaVnnT78E/jwcUwDkRkxF2DhXNPpk8ar76BVPEhwX9uOO1 M31CVCRVcP+wSnvjXgl6k6DeKNTd6cLbjcMkRyx/82ZfzDKntk1Hu0TIGGCdcQP8MDxA CaSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NvotOoh4; 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 g14-v6si14835391plj.146.2018.05.21.14.40.06; Mon, 21 May 2018 14:40:20 -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=NvotOoh4; 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 S932249AbeEUVj6 (ORCPT + 99 others); Mon, 21 May 2018 17:39:58 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:43563 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754376AbeEUVjz (ORCPT ); Mon, 21 May 2018 17:39:55 -0400 Received: by mail-qk0-f194.google.com with SMTP id h19-v6so12989399qkj.10; Mon, 21 May 2018 14:39:55 -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=q3eOdNWKnpc76XfNV8qnuPTBJFJUa+w7kbZdFsNZ34A=; b=NvotOoh451qyCBjUadmVzih/49RtXisEanlPEWBNVtyqsbmNBAzSfbTfFalOv5gcD2 J5u10NpJ7IWWd5XJJxCD93IgvA/ayi4jnN6hL5fnNajn8QKo88cTO6PcXcmbaLOq7lWp aKF3tkDCE2GLFV6qBL+ZdIgEmtQ+mJE/D5GNpKv0nd6V2ua7lXMlrhQateusTWtIkDEG iofmwFb+k8w7TF6mFkcEXDz6l4dm22jJcFJ1Rl4E92KKZUWukLbd7z6123VMhlbh32/A rnQh8r80guR7xOfxz2EGGcqdZBQE3pVBTvu64FOAsIiYm2Djj2IH1oUZru6EKnl0oA6v xBHQ== 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=q3eOdNWKnpc76XfNV8qnuPTBJFJUa+w7kbZdFsNZ34A=; b=c/bObvsh6IgsyziETfCTbCJlJDsYfGUJ/MNlfNpS10PxvMODOivXDSYqPWQIgAxgB9 WvMaYUMeOIC3ac134nUAlOFnMjAXHyopH02S5C+tFxcwCnJeIYIYx2WXlUfAZ/6LQb94 m7yobFHXhgNrXKPN+/xRU49vpDxAdw2PlNvB/I4oc8KPKcXWYlBkInYRtZ5/+CuzOcyp FSSfZKG8vIf2/FVMdeMfh4lkmYUaQD/APDM4G+GnVKTl9ZJHEbGumdlTnRCeejiQPLQI MCcZKSl3tGwYTqiPBFHmi3T7VJ/bbfLZ+KGjDhSOvGAH14pHSs0WTxY2VRrUSiy4vyLQ IKVw== X-Gm-Message-State: ALKqPweJfjSD0Kb0rW0aUgqsZ1RzSwDfkwe4dkFkznoVyLw0l3Mk+8FO o2Ijhq9FeHO5k+NRzg+wyf/CdlQRboYTtCN3+uE= X-Received: by 2002:a37:cbc1:: with SMTP id u62-v6mr17918674qkl.83.1526938794873; Mon, 21 May 2018 14:39:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Mon, 21 May 2018 14:39:54 -0700 (PDT) In-Reply-To: <1526903890-35761-6-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-6-git-send-email-xieyisheng1@huawei.com> From: Andy Shevchenko Date: Tue, 22 May 2018 00:39:54 +0300 Message-ID: Subject: Re: [PATCH 05/33] cxgb4: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , Ganesh Goudar , netdev 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 Mon, May 21, 2018 at 2:57 PM, Yisheng Xie wrote: > match_string() returns the index of an array for a matching string, > which can be used intead of open coded variant. > - for (i = 0; i < ARRAY_SIZE(cudbg_region); i++) { > - if (!strcmp(cudbg_region[i], region_name)) { > - found = 1; > - idx = i; > - break; > - } > - } > - if (!found) > - return -EINVAL; > + rc = match_string(cudbg_region, ARRAY_SIZE(cudbg_region), region_name); > + if (rc < 0) > + return rc; > > - found = 0; > + idx = rc; Is found still in use after this? If so, is it initialized properly now? -- With Best Regards, Andy Shevchenko