Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp243561pxb; Wed, 22 Sep 2021 21:41:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP86MCgjBSB1ss5A9dLHPZK5Y27g22J1581zclGM60kR4CFp6G8UyJ0GQC9zABE/yMCYUy X-Received: by 2002:aa7:d1d3:: with SMTP id g19mr3127822edp.103.1632372097716; Wed, 22 Sep 2021 21:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632372097; cv=none; d=google.com; s=arc-20160816; b=D9bFpv90WCEjLBylv7Lb/oKCZ8nGG/sCLbfxJI+9jiwszaG6ZddbwQDMdpzUJEvUQS tWes1p3yBiYNryOKVSPTZGwMr0zy6t2kSfxIiKpo2odG0pL51ygLXexFGBEbZXcvjE+B IsPGOtfF3QV0Fk1SJjLJ0LqY4Ot72OPpHl+DL7jiVVymYAZXSCoiJiCaMrWN2YQNC5hH lEv8QQEiec084x8OWIrDyjhj7UTt4SCMqjWfAW6FJAcTHKL0vKtgWgMAdiqujlAJg9zW IM76IGjfjcXFvUVJGPewVq+AAcRN+eUu7dpG0t5NzCtc4K0cQNcwCm5s8KhKlUjdE7EV xOdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kCkDRwUV24O6q9784PYpvoabmYuuEnKSIhX7g/vRBKA=; b=rC2lxl9Le7Q3o+7p4hrKMBhdyiKj8l8DANMm54kmOWTfrFNLjH3DxtAQIKj2BiOBVK rlmxh3dhWyz0tug32vegti9kgvvObFE9Z1r0bSerB9gcFsaSXdUf8pf95oIXnsyg6NUL 8VarVNqNCKnqrSuy+MiHeNQmpzriLzZWJ78HUHsbCtcrVXlE3njh4j5xuYvrljJ3fWLW WXMLf6Sh0we0vcq5mVTzQmuKEWGnFgXe84SmO4AFzK1UF2yQprRvAbv7UDtm1uVG2rPd FaJkQ0wIZokBCbZ5C3J3wFIcdJM4ot6S5r1FhItYClNyxn6EMPQXw9bszhtoqwVZ6VJT WZaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G15qTneD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d19si4768539edq.331.2021.09.22.21.41.13; Wed, 22 Sep 2021 21:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G15qTneD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239126AbhIWEki (ORCPT + 99 others); Thu, 23 Sep 2021 00:40:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbhIWEkh (ORCPT ); Thu, 23 Sep 2021 00:40:37 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54DDFC061574; Wed, 22 Sep 2021 21:39:06 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id n18so5024424pgm.12; Wed, 22 Sep 2021 21:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kCkDRwUV24O6q9784PYpvoabmYuuEnKSIhX7g/vRBKA=; b=G15qTneDgptJZlwqHehbOX7Fsrf1H92nQ6qIRkm9EgfKf7J7JVHIYLpmzDa3Mkxj/J 5YlBX3BKLobGYclwxw5gyterRL9HImwI7bD0CUbO3LAin0Dl+Sl4nqJ9KvL1BVTujjQi +cBbea4g005TsioGeFjCs/o9fwgftM8QQwLANN0lSmQxiqPgE/dRx8PDnCrLtNsk/ygN izKN/VrJyWdv3sh30qNzv/hiMQwHmrRftfm2e37iCWVQ0/A2CtRVsM0dpXUHKG0aMcHY vTk1AWSAOOSiQUwEnbcGTMeGmfUTEjXWM+BE4j4kdgClxMiIEC1tk7oFhkxiBQV0d2gz 4F9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kCkDRwUV24O6q9784PYpvoabmYuuEnKSIhX7g/vRBKA=; b=MzUSNd3PxM6pH9aA1pzzCFz6DWj1m2ESmik0NQsJiF+KcJzVcU1FQ4MvwWwrzo6MBX BsLyVtvEEcHR/QL2dfvjOQ1b86jEltqzMJz+lwuXpGZTwPffaVyMNQ2tZ9LENLi+CrzI 1MPXG7tR914GlWHkHYkpz02U9l+3GmzeXbgip4GI2SDoFCAHjPQjxCl4A1oSA3+jEz3R v2N0nEyvYnj94XXbN7JD2lBwPq7IMoN1F4o1lKdzAIUomGbkTcL/ynz/v8UpEijaqjtM Ot99TnLqb8ra8KEjwZQMdSQNj/fMmOaR2dZ9bw7WbPjvUXCA56KqTNWw0QLaJsBbODhB YEGQ== X-Gm-Message-State: AOAM533r7IJKu4kZaAC9rL8N88Txq8PJ2CEtNoh+yJ7scQSFC94yggTB DQLtPWA8n7/5kyGvR0n9UV0= X-Received: by 2002:a62:31c5:0:b0:447:b30c:9a79 with SMTP id x188-20020a6231c5000000b00447b30c9a79mr2519415pfx.67.1632371945257; Wed, 22 Sep 2021 21:39:05 -0700 (PDT) Received: from google.com ([2620:15c:202:201:f198:36ef:2b9e:5c76]) by smtp.gmail.com with ESMTPSA id r23sm7395480pjo.3.2021.09.22.21.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 21:39:04 -0700 (PDT) Date: Wed, 22 Sep 2021 21:39:01 -0700 From: Dmitry Torokhov To: Cai Huoqing Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] Input: colibri-vf50-ts - Make use of the helper function devm_add_action_or_reset() Message-ID: References: <20210922125212.95-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210922125212.95-1-caihuoqing@baidu.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Cai, On Wed, Sep 22, 2021 at 08:52:09PM +0800, Cai Huoqing wrote: > The helper function devm_add_action_or_reset() will internally > call devm_add_action(), and if devm_add_action() fails then it will > execute the action mentioned and return the error code. So > use devm_add_action_or_reset() instead of devm_add_action() > to simplify the error handling, reduce the code. > > Signed-off-by: Cai Huoqing > --- > drivers/input/touchscreen/colibri-vf50-ts.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c > index aa829725ded7..1a1d8e70ec40 100644 > --- a/drivers/input/touchscreen/colibri-vf50-ts.c > +++ b/drivers/input/touchscreen/colibri-vf50-ts.c > @@ -271,9 +271,8 @@ static int vf50_ts_probe(struct platform_device *pdev) > if (IS_ERR(channels)) > return PTR_ERR(channels); > > - error = devm_add_action(dev, vf50_ts_channel_release, channels); > + error = devm_add_action_or_reset(dev, vf50_ts_channel_release, channels); It looks like there is devm_iio_channel_get_all(), we should be using it instead of installing a custom release action. > if (error) { > - iio_channel_release_all(channels); > dev_err(dev, "Failed to register iio channel release action"); > return error; > } > -- > 2.25.1 > Thanks. -- Dmitry