Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp813906imm; Mon, 21 May 2018 15:01:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpa8hsV/YGTYXngwZiD9kVqXQCY4mqKMqJn/XaKdhu30zuc9Wpi3cJ/B/u1AYVhT5GW+SYG X-Received: by 2002:a62:93c8:: with SMTP id r69-v6mr21586206pfk.59.1526940060301; Mon, 21 May 2018 15:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526940060; cv=none; d=google.com; s=arc-20160816; b=vGyhRr3PJzGfvOb7kou8FR/r8785V0UhIl4DHc2vvFFBZOg0QNw5UYnOXffuFOvBCm WjGRoZWWVrA8w26uF+GC7gu01sBDdxR03BFk8OrUjzXJv3NJGvDqlVBtv4G+Xy2rfvr/ 7ckKiiEdluM0GNB2c56O32QjkopFXL4QujEb56gevioRI3sMk5Ircq08RZYCR11Hza1Z 8Ec9Ig25Bn8ITn/51cLA3qx4TZx02/paiZW9JKO03mxRtyxOIT5JcUosOqSaQnoLo7Hm CC+sZVTQ0s6U4KwDg+U3VRu4sIbRtgpqGn4AsOAkQwXjIqPgfEo34c8D++4Vs/JVuO8G X7oA== 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=TynbNsAL68661Tvqslkz/y5k748pbiDJID7zwicDVZs=; b=gqnWJoRSCJoJt8O4NHNtfTjCl3CfAHuXr+Xm1taH8N18SFakG7o6asQB47siXMjUdG vKUGwX2EH8nkTRYzbaUzVCrDjoFaA9KNdlNGNXnr/CLYGi/bjhgKO1hT8k3RQsCMqjdE 0KxfgdOxorXG3/GXwjB37AhSX7TTEMKT8J6uJhpCHS1EKTQNSjNaHBk8JsbtwxP4HpiK EJcQjD6cwkz2IwcuDNO2y1SQ0/OnxS8dxqdSN86eGPOrL5HoOu4hF1l0hTtdiBRNLvrM s7Zwlfx7d7Km9kC98IBe7lSyZvJhEN19oqycoS7sdIs3m9JG6K0MTsdOJ8p6pt5E0RoU Z1LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LRWEuPU6; 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 w5-v6si11824246pgt.68.2018.05.21.15.00.45; Mon, 21 May 2018 15:01:00 -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=LRWEuPU6; 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 S1754173AbeEUWAf (ORCPT + 99 others); Mon, 21 May 2018 18:00:35 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:41420 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbeEUWAZ (ORCPT ); Mon, 21 May 2018 18:00:25 -0400 Received: by mail-qk0-f195.google.com with SMTP id d125-v6so13019808qkb.8; Mon, 21 May 2018 15:00:24 -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=TynbNsAL68661Tvqslkz/y5k748pbiDJID7zwicDVZs=; b=LRWEuPU6p3UAun7pnjdMORKwNdUoFi3e/LA0ZCScmlzvWMrENktUvitaqDbTXU9BIG A6GnRNg7ksCTPBe34EXtyOsX1csOOInbrL5lI5b6H3UoNo6+EkbMKiFp0p8MzOgIvfYH 6p9jmRP+Eu7ZTi98oDL+UmxBFermUhKsV/CV5doyuIR7aIAJ7Nw4WKGYiKY36JwUy3Ys WikCSv47+5WLXexVPpR6Bi8seP7PCIKnox+L/yGMndVvng7ffdpksp3pKkyT2mWHc/wV UX2VxAbax+21A6GQtcIO0KSoP0EXfT80bih2X2+d+EYMgquCBL6dAXbOV2CIEKH7+RmL rutw== 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=TynbNsAL68661Tvqslkz/y5k748pbiDJID7zwicDVZs=; b=m7M39g75lNHSM4VAM2qyuavvvFVYySyUfnHL499eWh/X3LlbKXr5rGIsBP1DY3YdiO t9IRcRCgonN+v/MmikFVl3bBZEcB72WX7sV9m7wf3+4v33AntXt7NFduTYuCvX0bUmPY 8lZoqipQWQ1b2kvHfXFyvB9d0T1MFEdob3P68boUvsXDH4X7udq0OnskCfEHQBTZWbu3 m8dpNtdTnP6M52RYz3o8u7KLsPj3uf0sj7BffvUvBndxoMuOL/f2RxDp3X/NZs2Rp8tU HQEP/0qQMSK6wAApfMyZXOhQlaHSZSxIwSpp+F9KwtunHVQPZm9gHrNgnxouKDd5wG/c /eOA== X-Gm-Message-State: ALKqPwclDIeHDsFNj5+eS5eZN+TDINzJEyrKINmHVd3A1W2/jTExvpkx kU5/I9KsyvP11VxX9UBJk3c4qoQhZOGB87yj5y0= X-Received: by 2002:a37:1f06:: with SMTP id f6-v6mr18613132qkf.147.1526940024181; Mon, 21 May 2018 15:00:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Mon, 21 May 2018 15:00:23 -0700 (PDT) In-Reply-To: <1526903890-35761-20-git-send-email-xieyisheng1@huawei.com> References: <1526903890-35761-1-git-send-email-xieyisheng1@huawei.com> <1526903890-35761-20-git-send-email-xieyisheng1@huawei.com> From: Andy Shevchenko Date: Tue, 22 May 2018 01:00:23 +0300 Message-ID: Subject: Re: [PATCH 19/33] thermal: db8500: use match_string() helper To: Yisheng Xie Cc: Linux Kernel Mailing List , Zhang Rui , Eduardo Valentin , Linux PM 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. > + i = match_string((const char **)trip_point->cdev_name, Casting looks ugly. You need to constify the variable itself. > + COOLING_DEV_MAX, cdev->type); > > - return -ENODEV; > + return (i < 0) ? -ENODEV : 0; I would rather go with if (ret < 0) return -ENODEV; return 0; -- With Best Regards, Andy Shevchenko