Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1275821pxb; Thu, 7 Oct 2021 04:41:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR4RhZacYVV8qCuUzKWhNM1woYh19VwLGlu19jNju3TQuyMlItETLJfop0jHgnikfn867l X-Received: by 2002:a63:ac1a:: with SMTP id v26mr2443408pge.105.1633606903749; Thu, 07 Oct 2021 04:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633606903; cv=none; d=google.com; s=arc-20160816; b=fFOOnexeP2pfeeRl305osrbL/3K56ii6bFwxsIuFdM9HMoP1LtBV2PqMHPcKpkk85x RqAjArUmZPDV0i2kW2TrJ9i9dDfy2eGIiEd+0FhQHpULp4UCceUWHuoLiYnmsNhBJEEq jqaxMl/avfwxp6b8IrWHWi8vHXKEVMqC6Dwv7usr6oJCDAZY9liJqF0WGI+US22aUm/+ yTu8PY8MDCBK5hplWQj3f9t5ZnffZdhpKVU8KzWlqgMnwbmqHjbwRmzrxQQ20eOUqz2E Hykkxj3w2J4zRPFoUNjmxAnU8v2iYr0yN0GthquBbvVa75y2AWoh1OfssyOVGLjRbpTM AEhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=JYHMsVGs+mPhQpNSLcHrMGOqcM9n+tLhj8B8PR3OwPg=; b=mfyxIXLV7pX9GNjnYuRmXy+lrOgn10nFC+0y6rSr6sKmcxuOgJ2AbtsoO9cMHaX8wN eSJlkTnfvfrXGXpEw/qgBumJ9h7FJoBRgQzR59weL3/Fj160AKUymCW5uDHDO6//v6+B R/XOO0mzEVcMQFKt7SJyGE8FF+Ceoxuwpg3s+g6XsyEi5PeCwr3WJC/heTAY6Vub8UKx oFVcaXLdTKET6JYv2d+Qnyo/ekhi86owLqh/K2TkxBX/+W69S4wWFRHHpDeGhARjbXy4 +7uwAHMkhaLpNxyI6qQYUlHy0oSZLrSmuHDZfsPU8rD2pVmgQXQgzcAnmCbcRxXQFSjo BS0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=exSsfhQc; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si5490221plg.166.2021.10.07.04.41.30; Thu, 07 Oct 2021 04:41:43 -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=@kernel.org header.s=k20201202 header.b=exSsfhQc; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232749AbhJGLkm (ORCPT + 99 others); Thu, 7 Oct 2021 07:40:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:40766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbhJGLkm (ORCPT ); Thu, 7 Oct 2021 07:40:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 66F0B61139; Thu, 7 Oct 2021 11:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633606728; bh=L/hUnFbL8E5m8uUbr/4q4eZDVlgAdpApRMT2soUfbsU=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=exSsfhQcJLCg3pS34CUf3tR49DeihE8X0tgWhegqkCnyxRErRXtcg78s9nsDUmBRZ GGUXOEpzuUgcnOOOK6BJfdc2gGfTjoycpo8Xyw4drIs2nORs6n1rMzMNyxAfRR6XCe DtYJ1DhBahJkQVbhNpxUO+W5cdM8JvgjuvRCM67WCkRdn4HlVykT6qEKW4UgVAevDt pFhOKrNw15qJz6hkLP1PN7FbthJDQgB4eH4GU0Te5F3iaHN7cqvd9N4SxYM9wTcUAL 5oe/el/Ik8LqD0WY4id5a47ETAbiyFf4Q8NpGHPzUulYACeKHHfTJUGv2Ri1qf6X8g BirybJrt2C3Sw== Date: Thu, 7 Oct 2021 13:38:45 +0200 (CEST) From: Jiri Kosina To: Cai Huoqing cc: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jason Gerecke , Ping Cheng Subject: Re: [PATCH] HID: wacom: Make use of the helper function devm_add_action_or_reset() In-Reply-To: <20210922125939.427-1-caihuoqing@baidu.com> Message-ID: References: <20210922125939.427-1-caihuoqing@baidu.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Sep 2021, 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 CCing Jason and Ping to Ack this for the Wacom driver. > --- > drivers/hid/wacom_sys.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c > index 93f49b766376..3aed7ba249f7 100644 > --- a/drivers/hid/wacom_sys.c > +++ b/drivers/hid/wacom_sys.c > @@ -892,10 +892,9 @@ static int wacom_add_shared_data(struct hid_device *hdev) > > wacom_wac->shared = &data->shared; > > - retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom); > + retval = devm_add_action_or_reset(&hdev->dev, wacom_remove_shared_data, wacom); > if (retval) { > mutex_unlock(&wacom_udev_list_lock); > - wacom_remove_shared_data(wacom); > return retval; > } > > -- > 2.25.1 > -- Jiri Kosina SUSE Labs