From patchwork Tue Jan 21 21:14:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13946650 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.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 DE85F1F8679 for ; Tue, 21 Jan 2025 21:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494100; cv=none; b=cb5g7Vb8E1M8ubin6p2kCW3sfJ3O2ROrGeQ+AwbQuyswc1Gev0PbQLDvQJ7ZgQK8733oxA1PW4m/hsCTsbYDu9RYvPm00YnmmP9klq0wwwSvmaKTNvooC40Lljh9zNhAq9UYEiL8OVz4UQDmB4/NMBGR9a9bwGErOdfS97KaShk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494100; c=relaxed/simple; bh=zrzukfd2RSwrlmdRmszMLWOu2Hr/r69/z88bNUjZyEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dqAa319gWIyIk/mOwIydyeRG23fBGbfAQGUj0NSBSkadEPkWW1y2LykNdWeXgMKr4wa5HzbZ1UeyW1B7q5XcNadII2Y4FevGl51+M3M4rd8/V4FD6FQLWxeODvR2RGIWAtIrLS9nIwWLUrAwcEzokM6qkR6O0778O3+cAqXj7yA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=dcavbgJ/; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dcavbgJ/" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6d896be3992so44492406d6.1 for ; Tue, 21 Jan 2025 13:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737494098; x=1738098898; 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=1rVEk0Dr4duA7/mRQLTXbAYgAr33LOipnA2cEKQfgjg=; b=dcavbgJ/PlCBN+f2NFcb/sRWK/nA90h2sFl2NXgxHquL54tapS9LM6zbb7MPtbITjG SYRLne3FFGDhORp4OiGpNxfis3Xg4CSGHHnVbnsQc8254BJw0OOu6mo7x7NEVrMVagpv AIfkLmo8oSdiez2aFk7QgZ6oS2rxhG7/qdcyE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737494098; x=1738098898; 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=1rVEk0Dr4duA7/mRQLTXbAYgAr33LOipnA2cEKQfgjg=; b=HS6pYycXziGe2hyHZkpnBBtLeJZktOgOMPcFLVZj8CVOwjTCbdGYyCWwlb/9+AtKnN U/LHfXcFb1V2ogRSMfnOnd3/N5a/0Riw9CUY30VHrDj8qKSSzB3k0iX9p8rftSIddq7E EZd2+Xxa2F1KYt/e531L2Thhz6tkq/dsTT94yvMdwKGWVMiR8H39g0TDK2zc5xplTTXV KSKzJS+0keuiWPV5nfAf3z2bz00zoNCe6VCDYA/AEuBpQqDfung9Y5F3XLGVGojPxf7f 07Cwui4XSWL3MMW8zT9gt+3dtTozLAjRQ8taiZ3hHPiJhJ79AMSWEfMNdj1lqyuhijBz d9vA== X-Forwarded-Encrypted: i=1; AJvYcCVZa5XYpk/mPpRKnNiEXxnWjdtatecINDaguIH4+rxCNbPKA7bdl8XFsTUaKqfH+o3rFERMHHQKq61fsg==@vger.kernel.org X-Gm-Message-State: AOJu0YwFPh5NYraj530/1jCKKC7xOTirudf7qrhdjjUZ7DmaBgM6bvs3 EO6ZtWlQjWQBVK6G4xsUVB7ajU781Y3HJkbxuqYfYnRmkUP3dhMbeoCaopZPWg== X-Gm-Gg: ASbGncumBW/S8x0Ixw56umtgmoYy1I5H1nHMfBlJzMphatvSg5QQflTOa54lkWEvhk3 TaFc1J/wnMhO+Lijs42eMtFXqrxCOIduuQa/syq6e12dQX0JAo/LAXZCq6f7Sn5l71+aJr5EtVl ZmamGcJlJk2YFDP+93p16CI71Q29cl5DB8hw8IgOwGrPgdQYDD7teTqakr8Y760+5Z5C9bWVz5r wfqE0jbg98dKdqSUZfp5Q5hWuM8dcBUDAIHeNznaTOI78uwNC5adaoVzQNW5TdFRz6S8RwPPWDW cFl8vVGqxip2ypWFKmULySPoI62yQ18izjrwBLWeGTZBzUovfA== X-Google-Smtp-Source: AGHT+IH+AfjXa1HWP93h0DvJI7kSSGAfNsF6+75hu7mgbzlxXWv7+fIY3EtnqV1a4Imfwy4GAdj7Jg== X-Received: by 2002:a05:6214:762:b0:6d8:7ed4:3364 with SMTP id 6a1803df08f44-6e1b2168b97mr263725776d6.3.1737494097728; Tue, 21 Jan 2025 13:14:57 -0800 (PST) Received: from denia.c.googlers.com (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e1afc28f84sm54790186d6.63.2025.01.21.13.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 13:14:56 -0800 (PST) From: Ricardo Ribalda Date: Tue, 21 Jan 2025 21:14:50 +0000 Subject: [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250121-nuvoton-v1-1-1ea4f0cdbda2@chromium.org> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> In-Reply-To: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> To: Joseph Liu , Marvin Lin , Mauro Carvalho Chehab , Hans Verkuil , Philipp Zabel Cc: Marvin Lin , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Ribalda , stable@vger.kernel.org X-Mailer: b4 0.13.0 When we obtain a reference to of a platform_device, we need to release it via put_device. Found by cocci: ./platform/nuvoton/npcm-video.c:1677:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1684:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1690:3-9: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. ./platform/nuvoton/npcm-video.c:1694:1-7: ERROR: missing put_device; call of_find_device_by_node on line 1667, but without a corresponding object release within this function. Cc: stable@vger.kernel.org Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine") Signed-off-by: Ricardo Ribalda --- drivers/media/platform/nuvoton/npcm-video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c index 024cd8ee1709..7b4c23dbe709 100644 --- a/drivers/media/platform/nuvoton/npcm-video.c +++ b/drivers/media/platform/nuvoton/npcm-video.c @@ -1673,6 +1673,7 @@ static int npcm_video_ece_init(struct npcm_video *video) regs = devm_platform_ioremap_resource(ece_pdev, 0); if (IS_ERR(regs)) { + put_device(&ece_pdev->dev); dev_err(dev, "Failed to parse ECE reg in DTS\n"); return PTR_ERR(regs); } @@ -1680,11 +1681,13 @@ static int npcm_video_ece_init(struct npcm_video *video) video->ece.regmap = devm_regmap_init_mmio(dev, regs, &npcm_video_ece_regmap_cfg); if (IS_ERR(video->ece.regmap)) { + put_device(&ece_pdev->dev); dev_err(dev, "Failed to initialize ECE regmap\n"); return PTR_ERR(video->ece.regmap); } video->ece.reset = devm_reset_control_get(&ece_pdev->dev, NULL); + put_device(&ece_pdev->dev); if (IS_ERR(video->ece.reset)) { dev_err(dev, "Failed to get ECE reset control in DTS\n"); return PTR_ERR(video->ece.reset); From patchwork Tue Jan 21 21:14:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13946651 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.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 629461F866E for ; Tue, 21 Jan 2025 21:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494102; cv=none; b=ujXZhYZHDgqA2rTCCKU26bbeTDgO3uD7uFjFT6qIHEMB+JHdShwMIoHPWQ+Gq9Zx39OpXW/fm26NJzuyoGSL3uuwKfZ/fODqKxeB4n5S8h0n6JQkna4nb524U7YaRnsf/jMkOTgWsERBTtyTQ7NTdtaulzWuxSbiByZ8nJONvB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494102; c=relaxed/simple; bh=LyRuB8tAdiqBEUlnUkNNhNkm4Ba24Qlh5k9HJRNz30o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oRPnKBCBdK1O3S7vLG0HJxXIsasd9ULTRyQSy37kRYMTz56ADY8FNOsedOGsR9jU7CgNSgR9xXf7akWSv7FdNHC5FbCB1aVNJWJGdOYlH0PnfnrI9YAVlMlK7vSwgPHemtTMOdznpe9/4oNI7Bi8COe67iCrDa6nBVWb9tj7C+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Ub7PetYP; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ub7PetYP" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-6dccccd429eso56200086d6.3 for ; Tue, 21 Jan 2025 13:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737494099; x=1738098899; 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=YKIWMYbFrbAqwI1LUECt3RJuovYReI3o7uvAyeGPPzQ=; b=Ub7PetYPHpvycfl+SO+DvKyHOl0tdhn9hxO1Gxu7M6iyxsFZ/bkUlnX6hzCmsWk+XR JJZ71a+wCQf2kXyHsuukXsvUiCPZ6U6zkXwhgmNpKIx0BqVx3Oazl9GQfrJ26LieXxTY QxjrBS5hl0XWsSvlN1mTt2T+F9hBq/fgN8M6w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737494099; x=1738098899; 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=YKIWMYbFrbAqwI1LUECt3RJuovYReI3o7uvAyeGPPzQ=; b=WBC/FJefItAfbM0p23iVJSRPIAS1m5uNbsPk+9iZA/hzUOKCguLTf2zAezNlm+oz2T V8vE8tzXyfutRr49kxIluA71J3rcPCPDflmim+7+zEVjbMUuvB26Zwuu1wGyXKMztZol BAbgzdlZarFfZtvVOfF+yi3qDoSREINs0IvBaDNFDTRsC0FdG5ZYnrH1tEUxHK4XMSGu RJAt5zO7GkMUBc2m/xr4AKJIKSG9RiGWWbLdxVSAIGdswPC8rQ+3jFXHWjnSYwwiHkBG mzqgMHw3+Xx/2pgFjilzEfjXe/nwqqP/uEX9MvlrBHW2ZYn6iCRjnCNxl5tOpHwK7LGM YECg== X-Forwarded-Encrypted: i=1; AJvYcCWFcPuG48F9Xfx15cuuWb0RWA0CRpShXnjgYwyNXDygZqrsw+tI002oiIuiGOc3/mlwQ2KBtXb5YO/X6Q==@vger.kernel.org X-Gm-Message-State: AOJu0YxmcAaqZKlacy5uHYxqQYb5R0LkZjE+g3KOztvVhWclIpghhjYu mzhOsMw/x/+RcXu28sgXlNFoC/jq383DQxwC1Z9wMgSUzkjuWvJgkZVT/lg8GA== X-Gm-Gg: ASbGnctyZDjTK0uWw0OIeK9gKtP5FHJsFF/yPqjONAls0CfoH3DUuqp0ppOOyFSmZJm IWp+5ZSthq4Nra/YqAaDF/zlSFXeDE+Vyq0WPVzByu7HahYimFvZNOJ647GGYahBubUvFWlKA0U 9KjEyO5ju8XpZl+V7SoScI/20wMa5CzXnhJPnSDIWEyzdrc2T3O+vSOYeHZhJhLwp4fxvpuWdsy zy8CZ3xLaMTYbO+FtmvwJoQ2qLrHr/YgbOJ4n2oJm+QooJSvqwCJl/UXHunRG4Iq+AQjK6l5kOQ ZUqgazPIcjleDUzCrnyOOlv+ApQZUj0SB+8I2XEgdHnhPfr7dQ== X-Google-Smtp-Source: AGHT+IGahO5uMTq52/oBAxLhuuA75vO0AMXdFYbDv0vle1LutgvuSuhG7TKF9rnDFYbC8l6q7rTkxQ== X-Received: by 2002:a05:6214:486:b0:6d8:95c9:af2b with SMTP id 6a1803df08f44-6e1b224ca45mr298377446d6.35.1737494099195; Tue, 21 Jan 2025 13:14:59 -0800 (PST) Received: from denia.c.googlers.com (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e1afc28f84sm54790186d6.63.2025.01.21.13.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 13:14:58 -0800 (PST) From: Ricardo Ribalda Date: Tue, 21 Jan 2025 21:14:51 +0000 Subject: [PATCH 2/4] media: nuvoton: Fix reference handling of ece_node Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250121-nuvoton-v1-2-1ea4f0cdbda2@chromium.org> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> In-Reply-To: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> To: Joseph Liu , Marvin Lin , Mauro Carvalho Chehab , Hans Verkuil , Philipp Zabel Cc: Marvin Lin , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Ribalda , stable@vger.kernel.org X-Mailer: b4 0.13.0 Make sure all the code paths call of_node_put(). Cc: stable@vger.kernel.org Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine") Signed-off-by: Ricardo Ribalda --- drivers/media/platform/nuvoton/npcm-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c index 7b4c23dbe709..f6cba17a7924 100644 --- a/drivers/media/platform/nuvoton/npcm-video.c +++ b/drivers/media/platform/nuvoton/npcm-video.c @@ -1665,11 +1665,11 @@ static int npcm_video_ece_init(struct npcm_video *video) dev_info(dev, "Support HEXTILE pixel format\n"); ece_pdev = of_find_device_by_node(ece_node); + of_node_put(ece_node); if (!ece_pdev) { dev_err(dev, "Failed to find ECE device\n"); return -ENODEV; } - of_node_put(ece_node); regs = devm_platform_ioremap_resource(ece_pdev, 0); if (IS_ERR(regs)) { @@ -1692,6 +1692,8 @@ static int npcm_video_ece_init(struct npcm_video *video) dev_err(dev, "Failed to get ECE reset control in DTS\n"); return PTR_ERR(video->ece.reset); } + } else { + of_node_put(ece_node); } return 0; From patchwork Tue Jan 21 21:14:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13946652 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 0E4FE1F8F1C for ; Tue, 21 Jan 2025 21:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494102; cv=none; b=MzQNtZXt1rALydoQQ7r9qYvWdotv+ZF3wM1CO8Ir+uynSxKmYF4rne7HKTi7wbB7a/LlCWl2p06lq+ItYLgFp5J9WMBowX4Pyf/TVBHXkwRrzUnGNU70hn3dLFSWfyDWZxh0RGaG0KTWUdJF6pClHd8j+tm+6dxACMKKa2nVh9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494102; c=relaxed/simple; bh=tTQ8/1UIysiIGtRN5N7AVFPeTUIFvnP7hdQDtHKur8k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DCKc3ZSqfRRwDx98r6iqBX/AZtwTo5oS6hjgshV3R4BUPvQ72Cjc15NaZaB2Ydt6DF4HjWZNjEGv188fmXEYcsYh5ffkAmTE3lXzzjFqFw2PKJs+DEUhWxksIx8XeBnCD4crX35gPUYSP7qfgQl/NBnOOLkcGiNhF+/21XJbYrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=AV9z6Ioo; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="AV9z6Ioo" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-467918c360aso66734241cf.0 for ; Tue, 21 Jan 2025 13:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737494100; x=1738098900; 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=EDypBRxJvQaUqQoINiNHn6E1UtSb53KvENj6pqF6igs=; b=AV9z6IooxOHEPYoslE/9nMiJz3HRP3EGcoVDBq5TMRSuYhu3pHbzSkHLKYoN3wiJBr OU1fXlSWSmvmuxknEjz8MFZFHMi7jrlbxFeV0yu++h41eWj/3WYvgpUXy1yzDLhDIXas ym7VYm+DLeHpCMsWxN+nHq9+FAsO05kaSuEUI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737494100; x=1738098900; 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=EDypBRxJvQaUqQoINiNHn6E1UtSb53KvENj6pqF6igs=; b=xTGZby22PkDWkUcu5t2o9UkRFLXT+3Enol/NIqC5yvT2qNXsb4vXLZg7HNQgllNQIQ d69sIHoSNo+8U1yxuuJdkXgfhJRTw28hEvL+ywAxSazlPC2BQftc5DXlC+IZRHS5IiqD 6HwNDrnFeID3+yMlifUlr6IU0Qb+F2cCvVbpTNOlLgjkRbRDn+8yvn9VuZATgurfxn6c 7sHRNkiAsXq3FgOBDJicTql6tQKT6OqI/hiVIyjDO0A3yvyTjncLnrm29kN6iRzqbm5v 6LQpn1q2fq273kNY70do1JwZzrxkHYEJuLVIX6S37thy7x+jocRLLbnBdeshUuKCd8XU GuXw== X-Forwarded-Encrypted: i=1; AJvYcCUDRGipPKz7DVgCmfbQ/X8ykU75q1NopDvIrxcTf3z4BSQLHoGJ21UJH357OnqGe5cl/umYtCmk5gdzbg==@vger.kernel.org X-Gm-Message-State: AOJu0YyuOLglsSMyAmbbATPquWd5yfX66Qzy1qwZIMzblBg855iWCWFq bEp4r5+JB8sXwVRIgm6EvHJ4AcIlNZzRQRf9XZUybCDfS4bLpVw2hh6zZjYtEQ== X-Gm-Gg: ASbGncsx80XxVRVPLe5h4EkGnY+9XpbBND+dWxusP8Xvgwyl4nvVZ056Vzjwu8IJ5ET iS52b76mTE+eqpNKczF2tmH1VW6KgGm31HFgeVMbW51hgbUAZAaCriixBlRusbGPHwkOUgtQHH2 HR217VAAZaRBwPGWA9f2I6mWoMTfFR4OK3MovwWG845iQeI0nsMflfmbk09s9Ew+uyBfFY0OfzO kAn+Y6Tqt4/DMbpPZLKyWdeu7BZSEC1hN68ggwkr55Hejmiq55kkATH5pHh9+Veu+YBjHaWVXYx 6GWWt7wIp6xl1oZfKSD5t+RS6snJ1Qb3+eTek9SD4vEzf4Em9A== X-Google-Smtp-Source: AGHT+IH2nW3HKiyhk/ib7bj/aH6TJVLtiNxwx87MHvq1Ur/SwGzlc6RDNTd7PprtRI9dniJmJVuT3A== X-Received: by 2002:ad4:5d6a:0:b0:6d4:215d:91c3 with SMTP id 6a1803df08f44-6e1b220e572mr291236936d6.28.1737494100024; Tue, 21 Jan 2025 13:15:00 -0800 (PST) Received: from denia.c.googlers.com (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e1afc28f84sm54790186d6.63.2025.01.21.13.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 13:14:59 -0800 (PST) From: Ricardo Ribalda Date: Tue, 21 Jan 2025 21:14:52 +0000 Subject: [PATCH 3/4] media: nuvoton: Use cleanup.h macros for device_node Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250121-nuvoton-v1-3-1ea4f0cdbda2@chromium.org> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> In-Reply-To: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> To: Joseph Liu , Marvin Lin , Mauro Carvalho Chehab , Hans Verkuil , Philipp Zabel Cc: Marvin Lin , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 Instead of manually calling of_node_put, use the __free macros/helpers. Signed-off-by: Ricardo Ribalda --- drivers/media/platform/nuvoton/npcm-video.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c index f6cba17a7924..8e69fa14433a 100644 --- a/drivers/media/platform/nuvoton/npcm-video.c +++ b/drivers/media/platform/nuvoton/npcm-video.c @@ -1648,8 +1648,8 @@ static int npcm_video_setup_video(struct npcm_video *video) static int npcm_video_ece_init(struct npcm_video *video) { + struct device_node *ece_node __free(device_node) = NULL; struct device *dev = video->dev; - struct device_node *ece_node; struct platform_device *ece_pdev; void __iomem *regs; @@ -1665,7 +1665,6 @@ static int npcm_video_ece_init(struct npcm_video *video) dev_info(dev, "Support HEXTILE pixel format\n"); ece_pdev = of_find_device_by_node(ece_node); - of_node_put(ece_node); if (!ece_pdev) { dev_err(dev, "Failed to find ECE device\n"); return -ENODEV; @@ -1692,8 +1691,6 @@ static int npcm_video_ece_init(struct npcm_video *video) dev_err(dev, "Failed to get ECE reset control in DTS\n"); return PTR_ERR(video->ece.reset); } - } else { - of_node_put(ece_node); } return 0; From patchwork Tue Jan 21 21:14:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13946653 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 F35831F91E7 for ; Tue, 21 Jan 2025 21:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494103; cv=none; b=VlorNMoIULYpc6TGoUIcusKJuHLjJqLa1TzC0R643xHxNBCkJwIoElnDFCis9ouJyOZcln8sP1AlUoTxlaPifhLD/P4gU/6/U/FKxbmiqtqAyI+6Ko3IcoId0Y2gtodMDoHOwkaERQ4KDBjxHZ9waXId0r2e/xIJe7x1GBkEmHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737494103; c=relaxed/simple; bh=2nI2AcTo5FGfPAE799IDNWIsZ/sUcy0VR17PhcaK6HY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=flQZfeeGZ15uZcNyDt48Au5oWyhm4vwZCx5W2IDm26OO0BgUA/3qS7Y9BfJtchxNemgkbsnFHy/4+BUSewFDVdLPxLtD02JAy/syEaQjx8sDrWtzxm6ryzJYk7ejrKHOACNDxCSKZVvhuV+udmNB0/QQZp5Cm+f36MVvNTYmPcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=jyDkYt8s; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jyDkYt8s" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6d8e773ad77so49000536d6.2 for ; Tue, 21 Jan 2025 13:15:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1737494101; x=1738098901; 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=AWWHKFVC6UKJydJIK/G7foijQRC+Q1BFZCM05TTLGSQ=; b=jyDkYt8sFBqwzZjKNUEFVsPSqHABtwDdrpfuUGrw5B3NImQgF6NC6BiefXGf0f8GBn oHhtLGZkoQKR8AaKU9clXHqA4XqKv9hPuxw70Lyd7lv5H+GZb3zkfS2QJgsw+EfOV3hX 580FFpjdLwnGsS1qy39RcPKk2cE0HojpHSdks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737494101; x=1738098901; 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=AWWHKFVC6UKJydJIK/G7foijQRC+Q1BFZCM05TTLGSQ=; b=nqDL90nujkCM/aeOANzebtXWSVKBMtvaK1Mse6u7GLloVAjmrtomTK0BerBsMf7IR2 1jrK2vwouRskIDE4AvN6JxT4yI8YF+ygzhYmhIVZB7fA8T5P4wNQndxDTkC22o23ldam 2cBwG8n6X5bey6tsS9zCEkspJkAXOcHMLFNMxUWOPHNxVoy2iKwK3jaVdVTI6BVi6+ZR cn0K5xiQdA3rMiAE9GXcJoC5Jx/cA8TcMGTerc2szwQcd39lTyF1Le7/M5j1VebBBWYr eiQhnksqieQll9+xfxNBMy7bCmesnTlBiS0a3pKoFczvPaIjM4ppW8qMlJizxp1XFVkB RWEA== X-Forwarded-Encrypted: i=1; AJvYcCUpmdfCnroyQ2Fa4XrJA3icCEK46T4qayrZvFNSwEJfXI9tSsYv5pEgpls9WQnmZatk5NVJAai6RfgoWQ==@vger.kernel.org X-Gm-Message-State: AOJu0YwABcb9YiLi15o4ZEw3k8/J1MLx7vRg1Rq/H7UaM1uyxgrp0nkB sKYIeALN18Kmk7czGHdkS7H+mYBgUkFIxUy5yMLHZLgQeD5YMuILuM1u8bgqlw== X-Gm-Gg: ASbGncvgUld0glHq0QQPG2jt6Tz71rn3i9Os3WzO8gizhWDLSLfYV+wGX/q1A3Np9aV Oz+I//gONJjThOGhBVaXPRt4jWLgOkkGXhVbkif0/cbY+7WCEfeY//hEMKWD6BWDzG5/fw57X6I qb1BGsIFeF0APtWjsAVb3UxYWIXE6d5iZQTbqPhqwICSckn4zVBxz/1YPthnzVaKsNG69/6XtlM MyONKVeByBxZg9/wXECzhLtXvE8ApUNGyt47fA+VtkzckZntycdmsmaodTEyUbSxSIxta7QH86a q5PcqbgGvP12N7AOF0jv7WHOJzbS9s470SzG7AxZWXb24VHD2A== X-Google-Smtp-Source: AGHT+IG3DsvcJCCgpRI2aTM0TBQe/diTS5TbE7HiFHeA/ESOV/zRmEEEPnnObFwVwY4g2OGPUbxevg== X-Received: by 2002:a05:6214:3006:b0:6d8:8aa6:ef27 with SMTP id 6a1803df08f44-6e1b2230914mr317755556d6.38.1737494100811; Tue, 21 Jan 2025 13:15:00 -0800 (PST) Received: from denia.c.googlers.com (172.174.245.35.bc.googleusercontent.com. [35.245.174.172]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e1afc28f84sm54790186d6.63.2025.01.21.13.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 13:15:00 -0800 (PST) From: Ricardo Ribalda Date: Tue, 21 Jan 2025 21:14:53 +0000 Subject: [PATCH 4/4] media: nuvoton: Use cleanup.h macros for put_device Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250121-nuvoton-v1-4-1ea4f0cdbda2@chromium.org> References: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> In-Reply-To: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org> To: Joseph Liu , Marvin Lin , Mauro Carvalho Chehab , Hans Verkuil , Philipp Zabel Cc: Marvin Lin , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 Instead of manually calling put_device, use the __free macros. Signed-off-by: Ricardo Ribalda --- drivers/media/platform/nuvoton/npcm-video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c index 8e69fa14433a..7a9d8928ae40 100644 --- a/drivers/media/platform/nuvoton/npcm-video.c +++ b/drivers/media/platform/nuvoton/npcm-video.c @@ -1669,10 +1669,10 @@ static int npcm_video_ece_init(struct npcm_video *video) dev_err(dev, "Failed to find ECE device\n"); return -ENODEV; } + struct device *ece_dev __free(put_device) = &ece_pdev->dev; regs = devm_platform_ioremap_resource(ece_pdev, 0); if (IS_ERR(regs)) { - put_device(&ece_pdev->dev); dev_err(dev, "Failed to parse ECE reg in DTS\n"); return PTR_ERR(regs); } @@ -1680,13 +1680,11 @@ static int npcm_video_ece_init(struct npcm_video *video) video->ece.regmap = devm_regmap_init_mmio(dev, regs, &npcm_video_ece_regmap_cfg); if (IS_ERR(video->ece.regmap)) { - put_device(&ece_pdev->dev); dev_err(dev, "Failed to initialize ECE regmap\n"); return PTR_ERR(video->ece.regmap); } - video->ece.reset = devm_reset_control_get(&ece_pdev->dev, NULL); - put_device(&ece_pdev->dev); + video->ece.reset = devm_reset_control_get(ece_dev, NULL); if (IS_ERR(video->ece.reset)) { dev_err(dev, "Failed to get ECE reset control in DTS\n"); return PTR_ERR(video->ece.reset);