Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp538563lqt; Thu, 6 Jun 2024 10:31:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXE6UwoZR1N5DmjDXiYfATQR7Y3lZQ2zJUK7jrJwKO0Zt45mWTY+1Rw/pN7aeoiO0ZZNy+knXpn+beB7iRKeQZlJNOfpf3tck9KOEG2YA== X-Google-Smtp-Source: AGHT+IGNa5AmtBBEBfbTGmKkp3nMvZk//c8iG6r2oE2y1ks7EWWCtrxZyjtNrc1n0pMgJ0JxSStR X-Received: by 2002:a17:906:7aca:b0:a68:ece7:8db5 with SMTP id a640c23a62f3a-a6cd665e55bmr15718166b.31.1717695072975; Thu, 06 Jun 2024 10:31:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717695072; cv=pass; d=google.com; s=arc-20160816; b=LQDZv1opicUOMuw4hJYS4/W/B7o1hqjgzKFSTVj1RYyfrk4qC8CzuxGvUJG5xe4cOJ Ya1pST77g+sFfCzXABRER9GMkRhQUHSE3k1UXMp5NsDX/c8cG4if91fKK6ffq7C1eJmT fJFpzyr7uo6UFIEdp2LkIKlWgm+dZ4zlzwvgSCZyGIeC1VhNJzo7nNr8ksksaEMI+jIk kTYkmCV4nnAuH9RHaoUeEh9cMiBVTvRwkP0u1CqvGr69gpJ54N3/TXgReiyTdM/WqLF4 vHxPNI5o7chAUe9bszg03kTpaRyu5UVrERCuJyr4V2SLuNUMy2iXnPDfvUnmQzstyGnW hgYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=v+BwTFlT0Dqb1hLwk0HOkD0++JxPtd2ESxQRZYddH2c=; fh=tUAC4oQq3UuKajr6ZMoB53sspoioCuMU4y0NrDbDhac=; b=dLHdOyagaGqkvPTuBbw8tvqDOnX2JRiPLDGLh01VgSR27q1YjXDwtIsYUd5mUMoM06 1A8PQ9ntoW2pXZtu339qYXflIpqa6nD1vfr+qG/j0e/RMYzhWzXbCCwErxy1tnXFQxnC j4zBo4FKEfNPPu3Lu1ay/Qi/PZMs+IFfWH+Bo7DAZnnh76qVDC2lfYY4LPXov76y/Vqi DCWHOw7n3QoMFxu1X6DUWMYTINsccD2ead5H0NHoB/VWyuhG6CVita/GSIGdBa02LYVO mXwDZDpryIJvVdyMyl/V+qseqKMGZIQmDL6uCGjuoSKE35muppxJOOOoJ4ymhYcWq+9T S8Hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FSjJLI1B; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204805-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80708798si95823166b.556.2024.06.06.10.31.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:31:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204805-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FSjJLI1B; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204805-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A76A81F27CD7 for ; Thu, 6 Jun 2024 17:31:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D768E1991B4; Thu, 6 Jun 2024 17:30:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FSjJLI1B" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B8A81991D9; Thu, 6 Jun 2024 17:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695046; cv=none; b=j5KSIonjANi84yVuO3vRhdgOJY06YHpCzZMS8onw5wZELCBav0w7Uz0uJT4M115N2CgWn5g6PRFb5JG6edK9oJET21xsmlns/0M7+CTpO7EGTbilAJ7+v+J/pVo5tvJLSO0F78EhXSevs7s/Ls4an2jVnhkW7zwRdI1nKO3ovXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717695046; c=relaxed/simple; bh=5YQCa8UVebd8nCd5+11hDHGlbqk8BQoGJTU401XyJxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DBn1vlIH9PnorWO4BhniM9m4egnP5zw1xD46r3bpJZjybpHHukdLIf1mkwsLbP4cxenZd5M+qj1CY4K3uamFG3sdPWfkfaFi6vFDqRO45QlsHIRA4Slg7OkWjopuk7E8NUGL9zjCbr2svPfuzajMJoh586+6oa83rYfrJkyyloo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FSjJLI1B; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717695044; x=1749231044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5YQCa8UVebd8nCd5+11hDHGlbqk8BQoGJTU401XyJxw=; b=FSjJLI1B0qDTAyaINsurGB9jH5ebSnuOUWkB1yyVzaGdUaZzYObrqx4S a7w2x4QpLWqqrOMQd+Ym5W/J7qXwsQAJ/W0BKc/iF9gu4wsxLo1tjtLzk j1zLhngpRT9FO6oAfcjmh/VtX8AgDSMs6KN68paNGuFsUjTkDzw9s0aRs rbGOCFfscsXQwpxbqQ11yec8/wNGuLAzgNXOy2fIPJtkGDZnoNIlcfuUD JI2nnJFXbcjvb8YSQSiC0qiFEohZv3vMF+H28swHfmjP1FDnYas4PUmQh u4aauuPdcC16cfkRx5Y5ekr3j+kFNAzF0SGbaYvTy8LkkyBOwXVENkzDI g==; X-CSE-ConnectionGUID: /VM9+RPXRQGky+F2kWzWaA== X-CSE-MsgGUID: 6qGyQckDSS+p996Xo4oLpQ== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14191999" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14191999" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 10:30:42 -0700 X-CSE-ConnectionGUID: +/WMy0gpS+204HBPvSapuA== X-CSE-MsgGUID: h74mzfkjSOqbenqFhNfL5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38164432" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa009.fm.intel.com with ESMTP; 06 Jun 2024 10:30:40 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 67E7AF7; Thu, 06 Jun 2024 20:30:39 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Pavel Machek , Lee Jones Subject: [PATCH v1 1/6] leds: spi-byte: call of_node_put() on error path Date: Thu, 6 Jun 2024 20:29:18 +0300 Message-ID: <20240606173037.3091598-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240606173037.3091598-1-andriy.shevchenko@linux.intel.com> References: <20240606173037.3091598-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a missing call to of_node_put(np) on error. Signed-off-by: Andy Shevchenko --- drivers/leds/leds-spi-byte.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-spi-byte.c b/drivers/leds/leds-spi-byte.c index 96296db5f410..b04cf502e603 100644 --- a/drivers/leds/leds-spi-byte.c +++ b/drivers/leds/leds-spi-byte.c @@ -91,7 +91,6 @@ static int spi_byte_probe(struct spi_device *spi) dev_err(dev, "Device must have exactly one LED sub-node."); return -EINVAL; } - child = of_get_next_available_child(dev_of_node(dev), NULL); led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); if (!led) @@ -104,11 +103,13 @@ static int spi_byte_probe(struct spi_device *spi) led->ldev.max_brightness = led->cdef->max_value - led->cdef->off_value; led->ldev.brightness_set_blocking = spi_byte_brightness_set_blocking; + child = of_get_next_available_child(dev_of_node(dev), NULL); state = of_get_property(child, "default-state", NULL); if (state) { if (!strcmp(state, "on")) { led->ldev.brightness = led->ldev.max_brightness; } else if (strcmp(state, "off")) { + of_node_put(child); /* all other cases except "off" */ dev_err(dev, "default-state can only be 'on' or 'off'"); return -EINVAL; @@ -123,9 +124,12 @@ static int spi_byte_probe(struct spi_device *spi) ret = devm_led_classdev_register_ext(&spi->dev, &led->ldev, &init_data); if (ret) { + of_node_put(child); mutex_destroy(&led->mutex); return ret; } + + of_node_put(child); spi_set_drvdata(spi, led); return 0; -- 2.43.0.rc1.1336.g36b5255a03ac