From patchwork Sun Aug 25 05:16:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13776665 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (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 37B6978C90 for ; Sun, 25 Aug 2024 05:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724563011; cv=none; b=MhBTEly3q0tu7U1XD7h7VVe8RJz2rCygQPiNhZPBjCfqLT1OhVznB6eikOVwIGH8J4eOaRxXjBE1Q0zSLzV4eyyvOTkDUThieRpG5vQPi459liqaxU0HDtdlaoAXFWQqq09vsbRZ+LzLA8wPtAeY8dRKpMt9bTkfXTdt0JCOUAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724563011; c=relaxed/simple; bh=sqiJcekYlNvrERH/iNSK4e0C6d+JRc5y3DgjnZym+KY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tAvyH5fXI+f/ZJd8wsAUlXAEnUiDk/GMKdefTsY3dj/19Zu43BqwGX8axi42gKhp+aiRnJLWeboVyV0W6KV8k7NLJavxh28jLM/WFFx+wb1xMfk2wpCXghafsMYcdceucJvP/bv9W3Vyj53fY9VRAt/AX1sJeEx8eqDyiRH8+EM= 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=T1/tCatQ; arc=none smtp.client-ip=209.85.160.41 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="T1/tCatQ" Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-2703e8d3f7bso2219421fac.2 for ; Sat, 24 Aug 2024 22:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724563009; x=1725167809; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+36NNSRmVK5FdylQPpVTYi2UVBcAisEyHgKp3fnH560=; b=T1/tCatQ0bFfakGNi+k7WHkuCQBi7aW1mabVu32bEdmDWMY5YUklzppiNVwVptjk+d XjOva2mHGJN14xmISWXdeklGkmRHEsCCMPUlTM7X+/2X/5a4CcxQhnwnloqDMoh6OOxy yQ8RD/IGvMiOvKd7Ft6swbMBfEv39Yo8mVabGp003aOTbxbdjR/UfILK0+/FnLlxAGen Km3MTh82ZmzTqd6WBZtpKi+QZ7b6rIz4qNUj6h0vkHZ6rXceWsfNjSlLVTp9B1vee/cz GZvUl1cacOFhocj2hbSICTjUkeab3pZnqX66attrPpxOgHKiYEvWh9tfNKUc7L8Q+1Hr l7Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724563009; x=1725167809; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+36NNSRmVK5FdylQPpVTYi2UVBcAisEyHgKp3fnH560=; b=M+QQtyLDQWw1r41covlz70OuOCWLZ2Qm4ij+Aizwqye3ArX3yecUpHAmSJb1HTsX0j vU1ypqU8KmQyhlfoSYarBOVfyx+mxNfTO76UvaVOc5CNGcPncnBeAUA/dgzq8VWcy7kD jVBOuNuAGm27XcrohshONTzw5aFJAWiRp5pN7UiT4pnbyMvUKkFTeOJ3uuhUWOxABNcv Q8jxXVM2AgFAuQsUrSPYASm8sFujOiXeuWfGRTQBC/mlwxjo0vMXeCfj6lSj8PmVxkTT uOJ2gCT0Ci3U2hU3wcLn2b4SpVteUt0/iNCTECGv7OYoGWvy3W/9JnyibLdIrtwp/SVP rQgg== X-Forwarded-Encrypted: i=1; AJvYcCW5zVgrxCgr/VJttOvhyIGd4eotjk3NR5zQyOkmCkRZsVaMOa9xuVklAklly/j11XhcwWM=@lists.linux.dev X-Gm-Message-State: AOJu0Yx9UYAt6PfwHUbUY4bnnXd52TWZnB6XbfJANLkOUq/OHiJdgIUX sqHojExPgwzvjfxH/AA9PaVM96/bRmQZOE0Q/Gw4qAZHOuMdYpuXLPnh1w== X-Google-Smtp-Source: AGHT+IH50jfqsAxngsJyrNPRIognUKjg0ENHDCRW+P0AHBitO/WlT6UscLBhxwYmGb+kHjshcMLPag== X-Received: by 2002:a05:6870:2010:b0:270:1fc6:18 with SMTP id 586e51a60fabf-273e64458d2mr7894304fac.3.1724563009229; Sat, 24 Aug 2024 22:16:49 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:66dc:ce07:b7cc:51ea]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7cd9ad55a94sm5622442a12.57.2024.08.24.22.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2024 22:16:48 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Michael Hennerich , Shawn Guo , Sascha Hauer , Fabio Estevam , Laxman Dewangan , Thierry Reding , Hans de Goede , Tony Lindgren , Jeff LaBundy , linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH 08/17] Input: iqs62x-keys - use cleanup facility for fwnodes Date: Sat, 24 Aug 2024 22:16:12 -0700 Message-ID: <20240825051627.2848495-9-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240825051627.2848495-1-dmitry.torokhov@gmail.com> References: <20240825051627.2848495-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use __free(fwnode_handle) cleanup facility to ensure that references to acquired fwnodes are dropped at appropriate times automatically. Signed-off-by: Dmitry Torokhov Reviewed-by: Jeff LaBundy --- drivers/input/keyboard/iqs62x-keys.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/iqs62x-keys.c b/drivers/input/keyboard/iqs62x-keys.c index 688d61244b5f..1315b0f0862f 100644 --- a/drivers/input/keyboard/iqs62x-keys.c +++ b/drivers/input/keyboard/iqs62x-keys.c @@ -45,7 +45,6 @@ struct iqs62x_keys_private { static int iqs62x_keys_parse_prop(struct platform_device *pdev, struct iqs62x_keys_private *iqs62x_keys) { - struct fwnode_handle *child; unsigned int val; int ret, i; @@ -68,7 +67,8 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev, } for (i = 0; i < ARRAY_SIZE(iqs62x_keys->switches); i++) { - child = device_get_named_child_node(&pdev->dev, + struct fwnode_handle *child __free(fwnode_handle) = + device_get_named_child_node(&pdev->dev, iqs62x_switch_names[i]); if (!child) continue; @@ -77,7 +77,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev, if (ret) { dev_err(&pdev->dev, "Failed to read switch code: %d\n", ret); - fwnode_handle_put(child); return ret; } iqs62x_keys->switches[i].code = val; @@ -91,8 +90,6 @@ static int iqs62x_keys_parse_prop(struct platform_device *pdev, iqs62x_keys->switches[i].flag = (i == IQS62X_SW_HALL_N ? IQS62X_EVENT_HALL_N_T : IQS62X_EVENT_HALL_S_T); - - fwnode_handle_put(child); } return 0;