Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp392242pxb; Tue, 1 Feb 2022 02:06:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfJlDjpQuhKu2MIP9w/wjQWOlTsa+Brv1gcd7xlDq8+Lz6BGyAe2VfiyrOjdb+wJL1/qW6 X-Received: by 2002:a17:90b:4f41:: with SMTP id pj1mr1439941pjb.156.1643709978151; Tue, 01 Feb 2022 02:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643709978; cv=none; d=google.com; s=arc-20160816; b=WP3hLzwd5KUqG2CLxQZOLeCwQqXP/h/LXrNU52Y6vEQwLEou68xS+mlzv8L7e1CaLm UKYavB4Q9QqF8MgFq8tWyEIMH/zZgsP/ToJt+54oLqWVJ6C/sxTYUyk2trNGff8t/h7J 3GdmW+1A6a68nIq2GBrkxjL5RjQGHg5Q5O71KCRrvPu/hKQcerZjHgzfM1OkKND/BW70 9Y3SxZq36Hv+dTbAdgC3IzBDphCXGmUGZvzTWOj4g83J1nD1l4kAZ30gWcUfXAlKxSNQ Mt9w1oJ+w7PFj55mkuW0a+ebd7AW6qxBu+EQ5Q2VlvvT20vQ8asLjyZsvJjq0M964a21 5JBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/qLIR9I8QZnZJhomFuzGWk5rC5QcwEwCaK5rYXvXllM=; b=0U/s0Mkojhf7WuyiexKeymldl5LBcpvezIDodGrry5vaBro9exWe189JdBeoXnaeTZ VgzDJlhACj+Y7FC+PnEIuuGiShfW4JHxwcIayo8+hbbRuEwUGoKpWCOnnGF0Hm8K8oKU 3XZ7GvY23wfdfQcmt1jjhj0MddpypqwJ+pZOxvX5kLNW+JyJdxessTglB4KRPJfViG4y Ob3Y9Dea3MO3ES5oWPsPt68sEJFeHYRExZaNJVJF7WKqyy6HORsdRBBVZ7rpAbTJ1ZWw wa4RBF3MHHmytqAPc5SVg87lmPO+3OR0ECoR6cKtNYwYtbQnIaRWXpdEahl4+kbJcIKX HFOQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si17806106plh.519.2022.02.01.02.06.06; Tue, 01 Feb 2022 02:06:18 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241197AbiA3IGp (ORCPT + 99 others); Sun, 30 Jan 2022 03:06:45 -0500 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:64711 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238784AbiA3IGn (ORCPT ); Sun, 30 Jan 2022 03:06:43 -0500 Received: from pop-os.home ([90.126.236.122]) by smtp.orange.fr with ESMTPA id E5ENnTKm7uCn2E5EOn1iwB; Sun, 30 Jan 2022 09:06:41 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 30 Jan 2022 09:06:41 +0100 X-ME-IP: 90.126.236.122 From: Christophe JAILLET To: Dmitry Torokhov , Charles Keepax , Robert Jarzmik , Mark Brown Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , patches@opensource.cirrus.com, linux-input@vger.kernel.org Subject: [PATCH] Input: wm97xx: Simplify resource management Date: Sun, 30 Jan 2022 09:06:36 +0100 Message-Id: <87dce7e80ea9b191843fa22415ca3aef5f3cc2e6.1643529968.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the commit in the Fixes tag below, 'wm->input_dev' is a managed resource that doesn't need to be explicitly unregistered or freed (see devm_input_allocate_device() documentation) So, remove some unless line of code to slightly simplify it. Fixes: c72f61e74073 ("Input: wm97xx: split out touchscreen registering") Signed-off-by: Christophe JAILLET --- Compile tested only --- drivers/input/touchscreen/wm97xx-core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 78d2ee99f37a..1b58611c8084 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm) * extensions) */ wm->touch_dev = platform_device_alloc("wm97xx-touch", -1); - if (!wm->touch_dev) { - ret = -ENOMEM; - goto touch_err; - } + if (!wm->touch_dev) + return -ENOMEM; + platform_set_drvdata(wm->touch_dev, wm); wm->touch_dev->dev.parent = wm->dev; wm->touch_dev->dev.platform_data = pdata; @@ -629,9 +628,6 @@ static int wm97xx_register_touch(struct wm97xx *wm) return 0; touch_reg_err: platform_device_put(wm->touch_dev); -touch_err: - input_unregister_device(wm->input_dev); - wm->input_dev = NULL; return ret; } @@ -639,8 +635,6 @@ static int wm97xx_register_touch(struct wm97xx *wm) static void wm97xx_unregister_touch(struct wm97xx *wm) { platform_device_unregister(wm->touch_dev); - input_unregister_device(wm->input_dev); - wm->input_dev = NULL; } static int _wm97xx_probe(struct wm97xx *wm) -- 2.32.0