From patchwork Fri Apr 12 20:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788664 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDCC83D0B8; Fri, 12 Apr 2024 20:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955461; cv=none; b=NITQQoADDtNOSnAxlEjCaFvlAK4uv9yvY7v1KwlnWC3c+j8OC9vCIBbyg8UyhBrpAMoUEQFfbjlcAvQP+p8kDDKClQmGVAv12OpdGQBFDBxLw4G4OEstWOguxrL3W+UeTkgFYgwIwAhdeuH6uPusCUGAePLacnn7PqGTheEBk5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955461; c=relaxed/simple; bh=BVzVqp8trzkV4ZG9KOZgQC6TrXg1L740OrPWMBaBgXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OJpj8owj3QrkLU+OmIeN1HhSVyHrEk75SKMLmnKLKgRh73GrgHs8wakMKd8Z5+5q8Xkj4ZKeB8jC+3euRAxG0YSRsg9RqtENmUHPxjfLwBafqSy/Rs5meyyM3jOtt4cyBZzLBGHEVMsZbL3glplaF5Jehj2dtkm3fDO5LiAzMg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YVigdaAq; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YVigdaAq" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-346f4266e59so951430f8f.3; Fri, 12 Apr 2024 13:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955458; x=1713560258; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FCkHkDQ/J68KHhz/dTMPvVvcbRSRcKWJMB2HWO4YtQw=; b=YVigdaAq/g36pPt666tgFMPxBOZfCoPlRZKNYP51yaQI19VMc7ymugrL5scdf3Om1s iSsF9RUYTcEMEKEQtJ6RBNB0BQShEv+GVXZ976ZLaaWkHpxd1QxEWfk3xBT25BHWR37c h6C8vdSfyadOdlZcfND/KLzQTQwOcJUtYlZAnJ9Jr3IFyO/5EG/1n6DQPdv9UpUHCHqz 8QrRmFW64LLGOPtKZxt4MCzME0HzRJp+ce6tsEZfLOny8E1GpRpBJ70SBTK89o19OzK6 pTogzdPIvswYNYZ7QExC/cOH4t4MMH2takafohrQqo2+LNwf7pkC82E2MeW4Uau9L68y uClg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955458; x=1713560258; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FCkHkDQ/J68KHhz/dTMPvVvcbRSRcKWJMB2HWO4YtQw=; b=lDx8sKuRGM6PxW9epm3uO3C6co9p1xwiQ6Ixb+i3wW7B4aFou3ADTbgr+H4DMINhca txg8rcwzMQzWNjJhVMbiDdVSOKHpGVRhJLYEYlM/bHEgfbO7slk9j1bjcejKHp7aZG+c ryCZSEcUZSJYmP7uv/P2rngAw1Iy96TahhXcOGbjddjiDuCcs84k7yrl1WWIxmxxk/sb u3OgvkNWOsVd+qn5TG13w7gdu1PYzFQwtuuhF17hMk61R+C+R5WGvyJM6wA9lpfP0ctD vUxnt5edZ1TpIhxVtR+Fzez/fbGY/C/y+gsolho7NTxecQyH1iiQ3WGG751QE7zLY1cH cCcw== X-Forwarded-Encrypted: i=1; AJvYcCU1NLNoufZzQQVH7J6H9ldEeud21htbRmH4Uvua8qrZuURFaaB5zUDXG9exBJ8PZfV5v9h45ADs1SrBFpQe5quY89wQxJZWECYniwvP X-Gm-Message-State: AOJu0YxEt7Vt3tu0r4hQPjDxhPoGQaVW0szM2o/p3u6Ga5/rAdIfgptN wrGQyxu0EufoLpfPJ/dwBMP7AlKe6Px8CQGU8L6R7S6216XBrR2x7P3/W54Y X-Google-Smtp-Source: AGHT+IEQuY+GRVK7Mx2y0/jxPH/4rPt5kCgpEIOi6/M/lI6EsXKAEZhr2FgGd04JdKqS9jN2leaM9A== X-Received: by 2002:a05:6000:1846:b0:345:84c8:35ec with SMTP id c6-20020a056000184600b0034584c835ecmr3148644wri.61.1712955457657; Fri, 12 Apr 2024 13:57:37 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:36 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:30 +0200 Subject: [PATCH 1/6] input: iqs269a: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-1-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=1319; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=BVzVqp8trzkV4ZG9KOZgQC6TrXg1L740OrPWMBaBgXI=; b=OWZxFFVeMFbp30HoGyKbQFkZWG0nZLw2JOlLptiD8lPNzuuxYLdMYhN1UgLJdSPazE0fMQKYg XKjSvQEShV7AyK34k/bkzVlgM8b99ZaDo0BKWMMRJX/2ant8yoojTpX X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. Signed-off-by: Javier Carrasco --- drivers/input/misc/iqs269a.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c index cd14ff9f57cf..843f8a3f3410 100644 --- a/drivers/input/misc/iqs269a.c +++ b/drivers/input/misc/iqs269a.c @@ -811,7 +811,6 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) { struct iqs269_sys_reg *sys_reg = &iqs269->sys_reg; struct i2c_client *client = iqs269->client; - struct fwnode_handle *ch_node; u16 general, misc_a, misc_b; unsigned int val; int error; @@ -1049,12 +1048,10 @@ static int iqs269_parse_prop(struct iqs269_private *iqs269) sys_reg->event_mask = ~((u8)IQS269_EVENT_MASK_SYS); - device_for_each_child_node(&client->dev, ch_node) { + device_for_each_child_node_scoped(&client->dev, ch_node) { error = iqs269_parse_chan(iqs269, ch_node); - if (error) { - fwnode_handle_put(ch_node); + if (error) return error; - } } /* From patchwork Fri Apr 12 20:57:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788449 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 776B414B062; Fri, 12 Apr 2024 20:57:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955463; cv=none; b=D2Y22KDcqgf3HLfGTtvSjjDziS12jydJNyKS0Pp+JkNPYjX8Mkg3aXzSXW2pcEpx45ldi3Xy8/bYchLQHyMJDxhIjOe2/s7qTbt4NUq89zQMpbhYVDLXekVrhGhhpM7EAf2hl1KHQsNLUH7gxBYZhmY4EcezmVju8mqH8V20Qr8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955463; c=relaxed/simple; bh=bHQ5ybkYDk0fOfHbfP2h25h71UahoaKsFL86AulNsn0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F0jvbnez/E/TbxI4jX8rM+DCDyC3C+X2+3/0ZRiyDxzoySs4qOK8q+7fe7KTmhSDizFZmq7++W1ivFs/dETg9GUREVXjHGj0SPwvkBYW9qyFedJO4mS62NzZTJw9c6hyNO+GjnbBj3aetRaATlJWO7Sy3gBMtQlUXFj1D5k0xLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gzv2tOYe; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gzv2tOYe" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-346b96f1483so703452f8f.1; Fri, 12 Apr 2024 13:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955459; x=1713560259; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uOj4JmMFqTHFXBBftJzqfnu2FHUGLqUT9AgNpEyqCw0=; b=gzv2tOYelVK7MMaMVm9Idu3TZJEQF/H6wvBf/EUwsHVp1TZGilxNlUU/HerF6xRQcn IzMaAQaU9JIl6+7vP8UilNa8hqBZ0FM3g4sugR+RsqErGufQ4aoX8H2ykQBuiXYADcts WzOqqw6pGkMIjctLi6Cz7u3KiiSgpuD7gy/tXHxIsM04DyVCdZ80bZ6voVAdM1c3J4dU CsDk/S4VRLHj2RvBwdvS00gsd/5YGJyhPmVn+y40neePki8hUyd9Z5ROVtW2vK4nzKNi tULvEC7slnB4Y5/C4EMQROit5EMvPQKeCZ0Te7wky5r92Fjmbi6g1ZsgcGQamB49BksH YyrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955459; x=1713560259; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uOj4JmMFqTHFXBBftJzqfnu2FHUGLqUT9AgNpEyqCw0=; b=U3x3Z6LS66WfK3YZoCpe1L3NT3GKai/EzY/AVeiBuKHKWlUul5C9rdvjjk2zDJ3evn 40t85Up1d5V3s4eFVzI7cAGSMysFQot7IRS047j5s3YuQNb4UsJUAJ6M5odQQZMfo+73 /qg5fF3gTqQPWqLBA3nE7M7cMYXrj59v/d3Wh72EZxgHTvaY9VraVOtmudQ/qjF1YJ8K RSbmaza3y/rNBw0ap9eXO6SMUid6+O2OUeT5dlgv5nG+RMErJXsP+xnKsZpUbKicqKhH 5tjOKyine26u+0qCcfqO/b0SPGAkQ6XUia5JSrDhiLYh/WmPTHRfopNUCVm75+vdSNof 8kcA== X-Forwarded-Encrypted: i=1; AJvYcCWMIt90HtYPsedAkjWlaRxnJCR292Hl2gubrBbXKs9Il/WtThbiOBn2RLuJ2TfoECNcceF8aXtbqsVa4PzhKRUogwcfUCW3zDw+hWV8 X-Gm-Message-State: AOJu0YyPtB9T6eYQbegnL5GacJyCtz95ErtQdvCbKBq38qQb/wI99Lei OLN5ko8opJJ7Em0SGyyz7ErUmYVBtflzz8C/5oMmOuIflY6qsNyZD0iKMtHP X-Google-Smtp-Source: AGHT+IGBOLLPfBbNe7YQ9ApMXzauq2oxy0V7/7WxbASbJeYrHPSicKQQSYf4ovoCA59fS5JbaS+K7w== X-Received: by 2002:a05:6000:1ac8:b0:346:f935:e828 with SMTP id i8-20020a0560001ac800b00346f935e828mr2969704wry.5.1712955459130; Fri, 12 Apr 2024 13:57:39 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:38 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:31 +0200 Subject: [PATCH 2/6] input: qt1050: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-2-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=1642; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=bHQ5ybkYDk0fOfHbfP2h25h71UahoaKsFL86AulNsn0=; b=UVWCL1tscoqlpvQS2KBG1bHB3zXol2QGtLFAGqbkcNyC2zFqTtsffbpI+MSAxEzb2hREAC6RE v3+KlWQ0TPAB47+nb/iMfa+rGHrLOH0ER2+wHcTKR8F1D3NUg507s37 X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case the err label was no longer necessary and EINVAL is returned directly. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/qt1050.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c index b51dfcd76038..6ac2b9dbdb85 100644 --- a/drivers/input/keyboard/qt1050.c +++ b/drivers/input/keyboard/qt1050.c @@ -355,21 +355,21 @@ static int qt1050_parse_fw(struct qt1050_priv *ts) if (fwnode_property_read_u32(child, "linux,code", &button.keycode)) { dev_err(dev, "Button without keycode\n"); - goto err; + return -EINVAL; } if (button.keycode >= KEY_MAX) { dev_err(dev, "Invalid keycode 0x%x\n", button.keycode); - goto err; + return -EINVAL; } if (fwnode_property_read_u32(child, "reg", &button.num)) { dev_err(dev, "Button without pad number\n"); - goto err; + return -EINVAL; } if (button.num < 0 || button.num > QT1050_MAX_KEYS - 1) - goto err; + return -EINVAL; ts->reg_keys |= BIT(button.num); @@ -419,10 +419,6 @@ static int qt1050_parse_fw(struct qt1050_priv *ts) } return 0; - -err: - fwnode_handle_put(child); - return -EINVAL; } static int qt1050_probe(struct i2c_client *client) From patchwork Fri Apr 12 20:57:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788663 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFDA514EC53; Fri, 12 Apr 2024 20:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955464; cv=none; b=dgFWBHYj7Xb0xo6+B8KS07ybhBaK4fczFliVjFhJaFqSDHUUf/E+M+nKk0QQRt6r3hbNQrtem5DD+V8odW31i400NBaosoxV+N3eLeb8QbowlASaDpM83pxV6sVqGwIKE7DIy1Zx/rUXCqXCmYinUBdjHAUrrVux8e4e4pjflX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955464; c=relaxed/simple; bh=yybN5H4oObHCkRDUf64BlOIl6XPndTde/wZ7hvtw8Ro=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EqaOX27Fh1EYA30J8azeP/PPoEz9zRkw7n3ekhC/NNpCmcMfIayZoM7+6DtlfP7iMUF/6smAOprNOt1c/B6hJZIJN1D7WSE+96j1LkJI2Cj5WUCZ7JkjHzS1cWU1AJqafwWqjrcKdVyfD3SRXQGddPzaHApUPTQHeDjCPpPI3N4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I7GOo4FD; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I7GOo4FD" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-343e096965bso773402f8f.3; Fri, 12 Apr 2024 13:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955460; x=1713560260; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qFTL/XPS8muIk2z9FaL0yqV+OQccgX5te3Uc7bDfhtM=; b=I7GOo4FDbQtIGDc8wbQuCmQkqgsPF8YDrcXqWNYKQdoBfb4g1BuaAviVvuff8r+Ise 6+M3/PTQPSFas3ZFynHMkUbrfVTqN6DI7eMU+CgJDNzp1M2tQQiwBoVAzsO0yf2XTLWH ZaYP3fqZ+KxVbM7STXDd1M3U2SwjEBI31Xa23W2XFTn4TQqHzYvzhV5ofeNw6xT+2jak dsfzq6gjOWVesYwE/vxjXTCzFSu9a2yESgdSvHh7STgV2xlz/CtQCk2EqbmRHFdYZn51 MeT0AOsqej25o+5tiM3pzIGY3LLj3NKIh5MzR5XpUXI8h7ypbUFkeE+U8uOB7b/WSGf3 jp5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955460; x=1713560260; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qFTL/XPS8muIk2z9FaL0yqV+OQccgX5te3Uc7bDfhtM=; b=IaiH2hSPj7Gfp/QJ3mdA6B2OQzfB8ZVH9DVM3D0B1JchSBp09TB3J/3Qv3EZHQmPgK tLqqVr1RQ3LFXGb+9sBh3KCGkofCwOWuyNCrz3iE2EJbeABfmyj4i0ygnhL7ClMd9CQk iAtDsvSI/haCNjh67J0/qpLQ7gxN99e03PxFvmIiywSRc65U8lQ88yiMlNZKXZQW5Jy6 AnUjpf2PuiF5ngqAqbn9X1D2q8OwiT/moVyR8nKPn2E+RCJ8QYhp11DTtVyJ/isBcQvO WELyTP8JXi+otdZj4D5mW1YX01KOWruWj6f1bf5q0LONluTjOJf3sI8LqlFnQ2Nuwfzi e5mg== X-Forwarded-Encrypted: i=1; AJvYcCUgHhuY0yu/JteadlAg2aYveVq+jcK834x+rMAOM7PTfNESKSt8lKbs8aV4Zv/G9BVX08FV6e6MxjmlDC8x8UrHkSjZmE3rOBUnXFie X-Gm-Message-State: AOJu0YxHS30jt6LiQ5mrsKORViBg/Z+2asCbT1mI+ReM7AAqlWQBowZK 53ZzB+h2iU+CSiBkhkwZYElhTLHEwmdd17rF+n1juXxvaJl/6NZktfQuuy1X X-Google-Smtp-Source: AGHT+IFpNo0IogBt5RQ2X11DQ1uFX5es7IxiMnKitgncxozqISbP/ErHtQ+WkjGYStx7sr8zu01odQ== X-Received: by 2002:a5d:6087:0:b0:343:7abf:1a9d with SMTP id w7-20020a5d6087000000b003437abf1a9dmr2951826wrt.14.1712955460471; Fri, 12 Apr 2024 13:57:40 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:39 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:32 +0200 Subject: [PATCH 3/6] input: gpio_keys: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-3-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=1502; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=yybN5H4oObHCkRDUf64BlOIl6XPndTde/wZ7hvtw8Ro=; b=O1UMvpZsBrIYBxTC1o2mBCdut6xW2jrGI78N8KoibCQ0F6QmYzmhrcHtYofTYe6hVE8jJd6pf qHlQHbCw2twArYji/Lhb9irL+MOMLkdZgaGMZjk94YQcRua2tycS2Ax X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/gpio_keys.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 9f3bcd41cf67..9fb0bdcfbf9e 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -768,7 +768,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) { struct gpio_keys_platform_data *pdata; struct gpio_keys_button *button; - struct fwnode_handle *child; int nbuttons, irq; nbuttons = device_get_child_node_count(dev); @@ -790,7 +789,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) device_property_read_string(dev, "label", &pdata->name); - device_for_each_child_node(dev, child) { + device_for_each_child_node_scoped(dev, child) { if (is_of_node(child)) { irq = of_irq_get_byname(to_of_node(child), "irq"); if (irq > 0) @@ -808,7 +807,6 @@ gpio_keys_get_devtree_pdata(struct device *dev) if (fwnode_property_read_u32(child, "linux,code", &button->code)) { dev_err(dev, "Button without keycode\n"); - fwnode_handle_put(child); return ERR_PTR(-EINVAL); } From patchwork Fri Apr 12 20:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788448 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F9E814F124; Fri, 12 Apr 2024 20:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955465; cv=none; b=JKf+VpQjtmO8yqjTfxSnM3alzItQmLpJLObYV/hH6H67sHHCLVBKxIAVbVq442i9qBcooNOXKrL089L8SfzjqOIouaJxP+fJ223DzsAyS+h2UbSZwI+7sTFKPB7e97ZySdWDb7QZR/D201xkc8xv+Jl4FDkF8ABhxCIWb0+WsyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955465; c=relaxed/simple; bh=7hpHYy70ghhIyp3iV8DeFnaTe5tvDh2MTiU/M7Ph7aY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FYU32jmZHhz8TdE2y8AAVao0XJ27wsWzK0qD+BFXd7k7pewYTzjzyfgqNlw0yvKpWB0tUKcko57N7dLn+4EUuYfvR5z9CsM33ryHY0zB0RzRvHTmxkVuHNfWTaorHzpvXfU7/pFqxBomC6yndFkTLq2bvW7pZ5LkAhh8HPRTYiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E0ydVIav; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E0ydVIav" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4181e10b3b4so926155e9.2; Fri, 12 Apr 2024 13:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955462; x=1713560262; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QUNcSQI0xOoqnByekA7ZjQthM0HLAdbAOP6aM15AG6Q=; b=E0ydVIavGAt8BrSNCunG4BtA6f8i5NZ+RHkb7OpmV58v2HnzPRA6QUJJ8nVzfdBPg2 l7I6ihBX0pLSMM6deKwWIL5QTBNsJBKJ/cdsoqfewY5/VgjvWMqgzlq2op0OKV+UwCtz /F8aKkY8dR8bVrm/8OXp6/vbQNKHEVEoTs/HCuWY2y6re6bSvECp+lawgjXyKs4xqeNf SFrnHr6ZVbR5zAdRuaU4kg9fD6WJCp83jZHNVjLiVOW3BFiKKWinirGeuSWimNz7V6lJ NJeYM/yOSurjvdSfkP///ZNaG6ORPuPBugdKLory9bwA0XOxgs0SVSr3+qHKvABLVw6/ qFgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955462; x=1713560262; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QUNcSQI0xOoqnByekA7ZjQthM0HLAdbAOP6aM15AG6Q=; b=shgkSxD2PnUKo2EqP4aReZK7nZj6FiQBv4QwFH/dQG/I8KR1/mt8dmTPGkQbFNTzkn xVmzoUHs8SBzFb09SzPKDawF8HBIRzRHGGZmh+id/YLCRm+XleStxqZDlN5M9w3KKGGj 58+gi99w5wpshjVDV0Vf6SagbeNfFPmyAtl0zSiuwHW0+B1bFyW5FJ2zo5V8lYniRmcM j0gw6usITtLA+vr8DsE5cG0ZL6+0vBY0HKkhxuGW4RewspgcTsb44XODt91bz2HgSJs7 qj+U76iiKwrUPHKw8jQq1AFeywRN1NOK9YFfv2x+qfFnpC3gtOBpFxNKR+Wagu1gxzKO SeRA== X-Forwarded-Encrypted: i=1; AJvYcCXL9VgbWB2T7mm+oxW4PXJ0onKZUSW5KF3Fi2v+Y+2HHmhGx+K94AUd8zHFTyRQyOonkBAImgTZI7VJolOUv1LLE9738P06IwCWxGfM X-Gm-Message-State: AOJu0YxuEzrYU2PTbILpAa1MjzGCeHatYJactxnRSJIhQggRmuVLSq/4 Q5JEqtz5IOTJhb8oj82nkalGiCWpNqqpa1ONPOj5kVi1cd3yM7ei+plmpg+d X-Google-Smtp-Source: AGHT+IEMUEAHNBJn4jyAcQ2c1UA3x2d1j7AyxgK9Ok5sT9YubwnGW7+CXDcC7dMjB1rgQE3flGWEbQ== X-Received: by 2002:a5d:5482:0:b0:347:2077:53f2 with SMTP id h2-20020a5d5482000000b00347207753f2mr1422613wrv.2.1712955462014; Fri, 12 Apr 2024 13:57:42 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:41 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:33 +0200 Subject: [PATCH 4/6] input: gpio_keys_polled: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-4-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=1376; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=7hpHYy70ghhIyp3iV8DeFnaTe5tvDh2MTiU/M7Ph7aY=; b=iOhvYd8Tx/MX5bG8Bom4qyweZyNh5iP8JMZWhfDNufVK6fI1lrEM92B7AmfEtskEaLj8+M8SO j8WRHH0shWKDra1yP2SWX7dfAaBilNXZ83TJCJ5dBDNX0FslIjCdG43 X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/gpio_keys_polled.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index b41fd1240f43..41ca0d3c9098 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -144,7 +144,6 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev) { struct gpio_keys_platform_data *pdata; struct gpio_keys_button *button; - struct fwnode_handle *child; int nbuttons; nbuttons = device_get_child_node_count(dev); @@ -166,11 +165,10 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev) device_property_read_string(dev, "label", &pdata->name); - device_for_each_child_node(dev, child) { + device_for_each_child_node_scoped(dev, child) { if (fwnode_property_read_u32(child, "linux,code", &button->code)) { dev_err(dev, "button without keycode\n"); - fwnode_handle_put(child); return ERR_PTR(-EINVAL); } From patchwork Fri Apr 12 20:57:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788662 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FF79152183; Fri, 12 Apr 2024 20:57:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955466; cv=none; b=TkzwhMSP+q8wAPa22EZbh4CM1c8DRMgkSIrWd6I6aTSq6bv+iijwSfB5PNNiQIj1sLo2e77AB5KMpd7ES7ny3kkCm8TMhX6XQ4HCVEck0pKJNMipeax+jS7z4WDnfnVAMNsbD00+dldkwnHMUfgRVKB3BCO7RD8Hpdl2nQw9trM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955466; c=relaxed/simple; bh=My3kxrpMXWIXShvJZrEj9tARXzpifiSRwitXLmhirj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BiZemhJgpi1g6j/ctPL8lBFIplt9Rdqst2rT99D2DT6d+q2bvUQUA8n8eRFudnqm8B7Bm1vSauyfh/QSQNKPgNOjVuAdkJa2HvEbD3/XFA0BgVSoQ6U64RSRHoX2pCxLcliE5Ks83n75jCv689li8ozjQu8ALrMDpNAejznQCxI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F1CjdNeb; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F1CjdNeb" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4155819f710so9348305e9.2; Fri, 12 Apr 2024 13:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955463; x=1713560263; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+/w4DYQqdffdEqyUdCKkI4m/zBdQ+Y6o/WPdaWy4CcY=; b=F1CjdNebMqTOCPS0tYOiEERSnFvPf1I5J4P/zlJ9DSO6WtZVqeI+VCDzu1fTiQe2KQ DoWtgP9VrwZrPcvE+WxNJoBTcmiFQCcW5i3m07FEibkyGXNPogwoQpIgCVGbAXbHN4P/ vDr7CNdLSExuuTlvstxPF+RYqqV0xpITSDlwYJJtJF05p9ThgvHNf+NVt/28C7rgA7j9 2Z4Wlg+EKqrETph6lYaDK94YQBWfEOt/Ka40TPHWlMxHiQFwM+XSiuXMK/r1BK2LWKNY muOz5GzbciqCebwZoeux0Dae01hUjQnBO7SQgyyXFTwZe9Ou6j/p1Dz5iEKLip03rR3o 0Q/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955463; x=1713560263; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+/w4DYQqdffdEqyUdCKkI4m/zBdQ+Y6o/WPdaWy4CcY=; b=oTQoOU5rppE7UYpQ4w38R+nFg7dKNtz1Sl7lQwdderFbUHBR9VakBWm6KZ9mx6/7Lu 53v55M6lfzDAbRa7Kbfmda0pagjyRn4GFucHc7IFs8Ct5klMJXEsWRgAKhWWEiaPLAJW w3ZUkrbhTA8ME0/DXw/UAVEWxY+UKhDfKn7YPdhLdtq1V2jPhr647I6iEZtMzyAvJFu8 Wi//u3XfsUX7IfgJEwLp011goFjHotQ8VUARXsqZtR5R8JPXjWhRdUDl+UX5F5QBggqz Twl1Po885uJguzU46h9Z2p6S8M3CMkUR657dwlnkd5joqbD9KikPO1jha9bbuaoOcRE8 iKiQ== X-Forwarded-Encrypted: i=1; AJvYcCXsir5+IkgbkjrRn3ARXFL6UYb3f9wfcCVrJvbQejDZEfIVVQKfN2pi+PRzoZtjI7HEe+vyAzHeXPvtfA4BEiatB2K53OKLeg0iRhiF X-Gm-Message-State: AOJu0Yy6tCVqe+m+jVr9yTifY+yrj7Zfn2VUxSvQEleenK/9l2nRSyGe IfZ22DiPkEeFpS6B6pe40x0rdL4ugam1j0QSRTbcNwGiTcpdUcWI1rnFRs27 X-Google-Smtp-Source: AGHT+IFkIN/k0BMfai+sd93S2GLt3RxVOGKdgpADjsWAq2n54kZwNqV+27tQxVYUaIwddryC7yAZuA== X-Received: by 2002:a05:600c:1e8c:b0:417:fe3d:8ada with SMTP id be12-20020a05600c1e8c00b00417fe3d8adamr2575890wmb.29.1712955463332; Fri, 12 Apr 2024 13:57:43 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:42 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:34 +0200 Subject: [PATCH 5/6] input: adc-keys: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-5-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=1706; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=My3kxrpMXWIXShvJZrEj9tARXzpifiSRwitXLmhirj8=; b=IzjblgJnSVu11PE3U8HypEVhIu3/viMAHE0danzlk+ERonN2/D/K9Bdsj9AXbNXdv+W3jeGq9 80P1mKKnzT6Dc7rzjp7FOyqQ5ygraawqMIDA+4qGG6ocqT45unBKHFG X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. Signed-off-by: Javier Carrasco --- drivers/input/keyboard/adc-keys.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/input/keyboard/adc-keys.c b/drivers/input/keyboard/adc-keys.c index bf72ab8df817..f1753207429d 100644 --- a/drivers/input/keyboard/adc-keys.c +++ b/drivers/input/keyboard/adc-keys.c @@ -66,7 +66,6 @@ static void adc_keys_poll(struct input_dev *input) static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state *st) { struct adc_keys_button *map; - struct fwnode_handle *child; int i; st->num_keys = device_get_child_node_count(dev); @@ -80,11 +79,10 @@ static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state *st) return -ENOMEM; i = 0; - device_for_each_child_node(dev, child) { + device_for_each_child_node_scoped(dev, child) { if (fwnode_property_read_u32(child, "press-threshold-microvolt", &map[i].voltage)) { dev_err(dev, "Key with invalid or missing voltage\n"); - fwnode_handle_put(child); return -EINVAL; } map[i].voltage /= 1000; @@ -92,7 +90,6 @@ static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state *st) if (fwnode_property_read_u32(child, "linux,code", &map[i].keycode)) { dev_err(dev, "Key with invalid or missing linux,code\n"); - fwnode_handle_put(child); return -EINVAL; } From patchwork Fri Apr 12 20:57:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 788447 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC87E152505; Fri, 12 Apr 2024 20:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955468; cv=none; b=FvE8VlgYDd3QuvJmHtpPqLr1t9+mJARIJl4qMxlVTEtCNjrtWoTsNS5sMZSI2VDXTOtIv1Nur//tjq4vYTvQW0xNy3HLsr10UaQub9r00AkDL96cGYak4TLGrqxOQ37J7K0ZpofcXR3UBJXMHQAuNZBDMftahYYOk+ClR1zbBno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712955468; c=relaxed/simple; bh=d5w2MW9nK7KnKh8JKrlAqM0YsWFjjs+DBOWAWJH9N0w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BR5e+Cw6cBSxBkNw7tp6/B1hmD/WhVjMPUUVG8RiRJwvIhxWYepX8/wTZg1fa2lWk17NXa57PbdM36xmFuvndmRuGJzytyo/qoEnrhGt7qEL8Huqpa+1l+TQqhl7TkAiG2PNoiC7g5NSOccm/XJwTFE7ckojLmdIcyPuuUdy63k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q3scX9XM; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q3scX9XM" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-346b146199eso901116f8f.0; Fri, 12 Apr 2024 13:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712955465; x=1713560265; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6t7b3eK0fUcS94/uN1d+5XHYLVw/cvHYd3bbUDweOys=; b=Q3scX9XMWrJ8AEL7onE4uhlLfIND7lbHUZJ83/9BJDMc2dIfONy1pX9EC+qz2FB1tU 0kOmMdad07OByPapmOqdQgKKBLk2p8XYu9tEO2Shm6iXoKHZyx2591xGQk5ZcL0WJTTw KJKPVCsxNZeCNZ8E2F4GlPePXvERuOMHOm+Et3ZtOX/EVObRAi7Hd861GXXG0m66twi1 2udAtzo+teAK+8X7PjcsUoYnMlupbfO9+PRRCS6suviMP4r0GefyovekMhNY/R5LwSrW fqb+Nc48mTe6+uk9aJDfI7YRbc24akmODFYaCVpH1fGB35XqvEgyxeNdsbjjIM14nCj1 wh7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712955465; x=1713560265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6t7b3eK0fUcS94/uN1d+5XHYLVw/cvHYd3bbUDweOys=; b=d43pzi6JSa8tWhG2qZi6+bpm961mlfshBo14hoh83SMt9q2ACkimaUh3FITc/vHpPK S6KUaVTbsYGPe+yU7wUWypwNCoTS5jIxBaB7Ibl/VggOS9plasNatuTqcCDT2AynvcSy hRE3jFH4V0JgSwm7LBx5tmeNJe3+D6yZwJUimm36NX9uapR4W8WzBgpFjngrh4yjOZol skDTgymjtjKjy9UDK50do8Uk1IJlyVmJb+IV7Ki7zjw7D6PEs/NhZxnz7XP489qrPjca NX26vfL97EyNJsYPSvBWl52p3nUG5WnjSroE+j5VQ1AW8+ia0wqxKD3N/kXsBsJvQ+qf dvJA== X-Forwarded-Encrypted: i=1; AJvYcCWObugGjSMq3AphWqXxjVtULLt7Ck05K9hZnlFeRUIhZ4jdTzcWqzwcwOx8kou0GZh/vODkwqonFdAhoHQH9nUThA5wjhxb2sGsuYc/ X-Gm-Message-State: AOJu0YyKPcCgftTj5nFGKynSuo7blSiT0Y8qXmaBBdeP3REE1WqXnHwc Fcqn0vU5yzbV1SSGHaAw2KFrAISCEXAEmdMhQ7Z0JYK4OdvU3gd5Ic+bu+DT X-Google-Smtp-Source: AGHT+IHfeKgx+lF27zW8U7uJUFLX3yGe9p2iz1ZWNLQLEGeX6x6aG20TwM6ZEsgF3wA8/7rPV0kmoA== X-Received: by 2002:a05:6000:1ac7:b0:346:f79c:4e1c with SMTP id i7-20020a0560001ac700b00346f79c4e1cmr2588234wry.3.1712955464767; Fri, 12 Apr 2024 13:57:44 -0700 (PDT) Received: from [127.0.1.1] (84-115-213-64.cable.dynamic.surfer.at. [84.115.213.64]) by smtp.gmail.com with ESMTPSA id l8-20020a5d4808000000b0034599eca6c9sm4989203wrq.41.2024.04.12.13.57.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:57:44 -0700 (PDT) From: Javier Carrasco Date: Fri, 12 Apr 2024 22:57:35 +0200 Subject: [PATCH 6/6] input: adc-joystick: use device_for_each_child_node_scoped() Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240412-input_device_for_each_child_node_scoped-v1-6-dbad1bc7ea84@gmail.com> References: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1712955454; l=2409; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=d5w2MW9nK7KnKh8JKrlAqM0YsWFjjs+DBOWAWJH9N0w=; b=F423xtrd5wAb9rAY+vtPr1AoN0oRP10J2B/cyTTcz9sPPPWxKq5MlK2RQsesBbXB99e62vBg9 1c0trNaxF+sAY2zU+C59RPjtlUXm7140r3Z/s1cc/34S9+YrSplysNK X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= Switch to the _scoped() version introduced in commit 365130fd47af ("device property: Introduce device_for_each_child_node_scoped()") to remove the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case the err_fwnode_put label was no longer necessary and the error code is returned directly. Signed-off-by: Javier Carrasco --- drivers/input/joystick/adc-joystick.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c index c0deff5d4282..c7c2edf908e6 100644 --- a/drivers/input/joystick/adc-joystick.c +++ b/drivers/input/joystick/adc-joystick.c @@ -122,7 +122,6 @@ static void adc_joystick_cleanup(void *data) static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy) { struct adc_joystick_axis *axes; - struct fwnode_handle *child; int num_axes, error, i; num_axes = device_get_child_node_count(dev); @@ -141,31 +140,30 @@ static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy) if (!axes) return -ENOMEM; - device_for_each_child_node(dev, child) { + device_for_each_child_node_scoped(dev, child) { error = fwnode_property_read_u32(child, "reg", &i); if (error) { dev_err(dev, "reg invalid or missing\n"); - goto err_fwnode_put; + return error; } if (i >= num_axes) { - error = -EINVAL; dev_err(dev, "No matching axis for reg %d\n", i); - goto err_fwnode_put; + return -EINVAL; } error = fwnode_property_read_u32(child, "linux,code", &axes[i].code); if (error) { dev_err(dev, "linux,code invalid or missing\n"); - goto err_fwnode_put; + return error; } error = fwnode_property_read_u32_array(child, "abs-range", axes[i].range, 2); if (error) { dev_err(dev, "abs-range invalid or missing\n"); - goto err_fwnode_put; + return error; } fwnode_property_read_u32(child, "abs-fuzz", &axes[i].fuzz); @@ -180,10 +178,6 @@ static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy) joy->axes = axes; return 0; - -err_fwnode_put: - fwnode_handle_put(child); - return error; } static int adc_joystick_probe(struct platform_device *pdev)