From patchwork Mon Oct 21 20:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13844654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 879E3D17131 for ; Mon, 21 Oct 2024 20:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Bnt+KzLj0gBtQtESfccDhJlW0AjYZvv3WXxt0v6eRC8=; b=J0XMQMB9ujyn6y/n6i1Kj4D/CX QdfBswSGH6Ft/PcSY45yoHga3vtdBSbE18TaV8xMs+qyYeOyv3UFtjYReQWeBrupqEDJg7oI8Maia ZmOwN7lb/pEhX1x3j/STpPG0T1MMiQD1Q7I9ksI1WyWXhn+xq2ioV0MBmCAH0GLdukZy89Ql0aPtL 7Or0jS02OaaUZsDnK60LwjvGTobDjrfzOwOQJBa8Eivu674KNybQpGhE5CED5YJQvfQXz9LjS2ntA Wfv4myELXNjgZnM2StWZ853qw3dOknf885uL7e9J9Bze9hCZuJDtgCAt/y0k9yTJyaWlomhgbljEO eGNEWNSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2z44-00000008c6Z-1FbE; Mon, 21 Oct 2024 20:31:44 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2z0x-00000008bWt-3WAO; Mon, 21 Oct 2024 20:28:33 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-37d4ba20075so3692165f8f.0; Mon, 21 Oct 2024 13:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729542509; x=1730147309; darn=lists.infradead.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=Bnt+KzLj0gBtQtESfccDhJlW0AjYZvv3WXxt0v6eRC8=; b=SN1X9xtNYjMJUp/BbJdqPiulriBWUVsAXzoee4TwhZVflytgMsi9nKzHH0MyVdILIl pKbnK9/hzCzP8wX6j2CvFuK1lNvhO8kLBo7lHZ2t1W8a5upVd6yhpvHKg3uCevLQPhe8 hxReITTzilH/xGt7UcIfzxca/i248F48G/5A73Y8QfKUR0E7s8KTxffRJgdAKBpQ2HKS BLytZP3Lj0eIJoLSoI2DsHfIqC60SMzSuv/7xoloeXIIzHyOVKj6R8/11cqHobO+c383 1s2IWB+xin+Td7HKiOrOwd0yWjFOrnCcRiBeCT+EGNBxwGPTJq+k3m0Zhzpjt/sqOukM 8tqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729542509; x=1730147309; 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=Bnt+KzLj0gBtQtESfccDhJlW0AjYZvv3WXxt0v6eRC8=; b=Ws6tAgXqUfjHnlMlBzvG4Tiv67Feldix2Vclg9nRh7s1blJ71FeDTLFAUCcd3S906Z 1IeImbKl3WsD8fI/UqhC0ZLDFNqAiEis44E/0hgjCfyjkNHKNNTYCUEIUSl2rH/vPcHF URAtQxkF2+jgEKPK7mVA6CF0JAYHAwYwLAiOCzjg5Y4R2YNuMEWMTKoI663OqxLSuVjw 4vUcztK38QkgTxbqwWdRIpNTWoeQtVb6ReB6A4J26hcaUQr/R7ZyeShoTFEnUD+bNtnY MWId3YS2XGtJPW33uO5CyFH+YeRsxnHpzRXgbqzSy+KafhBGW4BkVbS5YitGFP+lzW4c 2W0w== X-Forwarded-Encrypted: i=1; AJvYcCU9CtvLXJ4ir0qI5wmyPEX4lAELLYBRhKzeSzANM95GW4r5RHxy0yLmJH2+OTLeNLIDvbHEbgiOlQ8Gp7RTaB2G@lists.infradead.org, AJvYcCUI6m3agVveFH0ijBKO1G/kZErqjQ0t3AfshfCFEVAg7e3zJDQumcXGrufzgougdO8KR2VPi/4dEH3OBTEjP0M=@lists.infradead.org, AJvYcCWEtIbaEJRshYStS5ac1UZN/3gdu482W7nzDPDugTu70x+2kkTzCPnydxPevU3S6O79stUetoqelY3ET/fnvnxdDw==@lists.infradead.org X-Gm-Message-State: AOJu0YwpoDy/WcZTDn25ZDw0HKatNijpQeG+RfRPfmMt/iDtt0OqVVur RswPRjs25ntMtkumoaPtWkPzd6XA0Tewims9Yx3rHhawoJF3FZpHWJKRKVWX X-Google-Smtp-Source: AGHT+IHcUlF/WH2MPR2lAsWY2YWdvWUxpJiy03CKuMiiIgxGTQhVcc8bGyCYchZqxExzbbX7v1K48A== X-Received: by 2002:a5d:5287:0:b0:37d:4d6c:e0ef with SMTP id ffacd0b85a97d-37ef21ac2b1mr254788f8f.43.1729542508922; Mon, 21 Oct 2024 13:28:28 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-023d-d91a-ee8e-da73.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:23d:d91a:ee8e:da73]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0a5b98asm5093263f8f.61.2024.10.21.13.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 13:28:27 -0700 (PDT) From: Javier Carrasco Date: Mon, 21 Oct 2024 22:28:23 +0200 Subject: [PATCH v3 1/2] Input: sparcspkr - use device managed memory for 'state' MIME-Version: 1.0 Message-Id: <20241021-input_automate_of_node_put-v3-1-cc73f636e1bc@gmail.com> References: <20241021-input_automate_of_node_put-v3-0-cc73f636e1bc@gmail.com> In-Reply-To: <20241021-input_automate_of_node_put-v3-0-cc73f636e1bc@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1729542504; l=3463; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=M/Qr46XFwQ4/bdir1XHUmm8htVq32+gFJnABKw/M8Is=; b=eLC/YTa39ljswAiRUJSjizOUy7uUis4Qgy9tB8DOpHiJSwZttYfbyRD7PSLEhYAB/prbxqkQ9 6T2OZDUN2oUDuKXvYkBEaNCIezAe0U9OtpB2rKi/1gTULR3vtmiQa8B X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_132831_924379_9CDBD944 X-CRM114-Status: GOOD ( 14.29 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use devm_kzalloc() in bbc_bee_probe() and grover_beep_probe() to automatically free 'state' when the device is removed. Drop the kfree(state) calls from the probe error paths and the remove functions accordingly. Suggested-by: Dmitry Torokhov Signed-off-by: Javier Carrasco --- drivers/input/misc/sparcspkr.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index ff7b6291894a..e484d79b5597 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -183,46 +183,39 @@ static int bbc_beep_probe(struct platform_device *op) struct sparcspkr_state *state; struct bbc_beep_info *info; struct device_node *dp; - int err = -ENOMEM; + int err; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); if (!state) - goto out_err; + return -ENOMEM; state->name = "Sparc BBC Speaker"; state->event = bbc_spkr_event; spin_lock_init(&state->lock); dp = of_find_node_by_path("/"); - err = -ENODEV; if (!dp) - goto out_free; + return -ENODEV; info = &state->u.bbc; info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0); of_node_put(dp); if (!info->clock_freq) - goto out_free; + return -ENODEV; info->regs = of_ioremap(&op->resource[0], 0, 6, "bbc beep"); if (!info->regs) - goto out_free; + return -ENODEV; platform_set_drvdata(op, state); err = sparcspkr_probe(&op->dev); - if (err) - goto out_clear_drvdata; + if (err) { + of_iounmap(&op->resource[0], info->regs, 6); + return err; + } return 0; - -out_clear_drvdata: - of_iounmap(&op->resource[0], info->regs, 6); - -out_free: - kfree(state); -out_err: - return err; } static void bbc_remove(struct platform_device *op) @@ -237,8 +230,6 @@ static void bbc_remove(struct platform_device *op) input_unregister_device(input_dev); of_iounmap(&op->resource[0], info->regs, 6); - - kfree(state); } static const struct of_device_id bbc_beep_match[] = { @@ -266,9 +257,9 @@ static int grover_beep_probe(struct platform_device *op) struct grover_beep_info *info; int err = -ENOMEM; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); if (!state) - goto out_err; + return err; state->name = "Sparc Grover Speaker"; state->event = grover_spkr_event; @@ -277,7 +268,7 @@ static int grover_beep_probe(struct platform_device *op) info = &state->u.grover; info->freq_regs = of_ioremap(&op->resource[2], 0, 2, "grover beep freq"); if (!info->freq_regs) - goto out_free; + return err; info->enable_reg = of_ioremap(&op->resource[3], 0, 1, "grover beep enable"); if (!info->enable_reg) @@ -296,9 +287,7 @@ static int grover_beep_probe(struct platform_device *op) out_unmap_freq_regs: of_iounmap(&op->resource[2], info->freq_regs, 2); -out_free: - kfree(state); -out_err: + return err; } @@ -315,8 +304,6 @@ static void grover_remove(struct platform_device *op) of_iounmap(&op->resource[3], info->enable_reg, 1); of_iounmap(&op->resource[2], info->freq_regs, 2); - - kfree(state); } static const struct of_device_id grover_beep_match[] = { From patchwork Mon Oct 21 20:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13844657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D864CD17130 for ; Mon, 21 Oct 2024 20:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EXOGORusAheGbXjY9YsHgDJ6EQdczoB5sORBvnGhFxE=; b=0HvnGIlup5KmRD6EX/G/EM7i6t pGMhT/udsMsPJnmPzqjXqJmc2FFTJ24ylqSdya/0EDJQXr/F78InuE2kClun7zro4gYFZEyFYdPsW 3sBg9lleqhLXSOBce0fFqbk69cLqb0P9v595ZExKp9/GQMU021BvLqMp5AlL8LKcl145Lg2YlDYJS /G2XrfQM5VC39/eGg2aOim5w3q+g+gJZzRohVoppbHZ1buFbKtFsoJgjfqU4VmjuMemlxN6aFd4Pa jDkhFeNMRHiC+6B/x4iDUwVOVzXtSiVusHQa99xDf26gzdVA6ZkBG+vuioXuedC8Aods/53v0M9zJ An5q44VQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2z5e-00000008cI3-3ujT; Mon, 21 Oct 2024 20:33:22 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2z0z-00000008bXh-3Jko; Mon, 21 Oct 2024 20:28:35 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4314c452180so39599075e9.0; Mon, 21 Oct 2024 13:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729542511; x=1730147311; darn=lists.infradead.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=EXOGORusAheGbXjY9YsHgDJ6EQdczoB5sORBvnGhFxE=; b=YVw/Q/6IU56w8GVn1ZpIkV4Br9W949xWG9l4UArgW0Sp6dXYX0AWQXr90LdTXqRl8A JUyXQNGvLbyAWjvxwiWfRIcApur8EJGHe19B7Y3PChAd912Ff3QOrA/AUsWxhwwZqs9d cvsin4DB0WmzEqHi5r0eeOcOf/kiQMYqJIfQt1Nu1Ziwf8MfVMkp7Ew6mau+AQHWH1Lk c/GcOH3JOFRBGrRFDiYnVbtOWq3tB/yrAI7iZ9XfQYgpfK6Dd0RZMwWInvl4tEEO63Ak tEE+je3WRUcJsgTtAOxvBmHCSgANPymakBFS/E5Ypw3hEzXDeT1mhqy/5/Oyg1w4P/bK vszw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729542511; x=1730147311; 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=EXOGORusAheGbXjY9YsHgDJ6EQdczoB5sORBvnGhFxE=; b=G+z4rJQm27vMH83EXYZBqo0R3c3Oz3Cy5fK6W/Ewj+fIbkdHuEc4ia4lvS0IreT+st vppZVmBg91GCt6lmJ1GaqwFBIcQRMzJgOSyAai0iNjX909upP9obm4EURAFNTTvOocOr KeaSvCoU54DQTS6+yVgy9vy5iHtrEVdrcq5tuOTV6wjbbx2vo0kFI86USO++coJtgojn Dnk4ENnbYjOytNwStwSH2kEIKq4CgPu1au54QYCM1MsEISmCRwA5gkjb4UKMrp7CUqf8 YCJTSfkFUK7zd34WOdlF6qE5g/FnPPUKZJuwddcls/CjELpNWgpeGCpxxYeTFjkMtpd2 Q4ZQ== X-Forwarded-Encrypted: i=1; AJvYcCVailwFPTX1iNYRyeIkn26S2j5Ovt2eTAnWbpVyoVsJfh3KliET2HN/+yWXfIP2t6cfVTCLvOO0zrbQril1w1Q=@lists.infradead.org, AJvYcCW5NCXkbR7cn8dd6FKOKrAvG8Y+gzrghjz5/FWDOZavvW+CfWDlJ55SlYkHtQeIpBTer4a+ATWnXCSmmnh/Seb+QA==@lists.infradead.org, AJvYcCWoAtlarrYG1csTsWkc8Y6itC0GflRNG3iWqXrfvJgHK0HmnrRdLBUSJLsnpHzIR9kzDJAHtkNhYpkH5fuowoZN@lists.infradead.org X-Gm-Message-State: AOJu0YxhD5Fj9QIgrkl/FJo27aeZpO87edeokRjJ9qH69BVPP+kbommv /ZQJj+hgaapkrNt9UujQCNaK9bTWSF4gc3SUntqugn3NMMQXDd1r5EGe74ZW X-Google-Smtp-Source: AGHT+IFeBUJWb0/ZbDfeWjDseKy/gwO7cFLphK1AYxGeWiXouKa5IzBBH4eytV8fsrQlZUdSg1h2BQ== X-Received: by 2002:adf:e00c:0:b0:37c:cc7c:761c with SMTP id ffacd0b85a97d-37ef12628famr494947f8f.3.1729542511079; Mon, 21 Oct 2024 13:28:31 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-023d-d91a-ee8e-da73.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:23d:d91a:ee8e:da73]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37ee0a5b98asm5093263f8f.61.2024.10.21.13.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 13:28:29 -0700 (PDT) From: Javier Carrasco Date: Mon, 21 Oct 2024 22:28:24 +0200 Subject: [PATCH v3 2/2] Input: sparcspkr - use cleanup facility for device_node MIME-Version: 1.0 Message-Id: <20241021-input_automate_of_node_put-v3-2-cc73f636e1bc@gmail.com> References: <20241021-input_automate_of_node_put-v3-0-cc73f636e1bc@gmail.com> In-Reply-To: <20241021-input_automate_of_node_put-v3-0-cc73f636e1bc@gmail.com> To: Dmitry Torokhov , Matthias Brugger , AngeloGioacchino Del Regno , Hans de Goede , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Florian Fainelli , Broadcom internal kernel review list Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1729542504; l=1243; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=F8YQ3HQYY2w+VhZkKOD4BkQV8/JYW/XDhWfSKzi9Psg=; b=M3sNpqf8PQCbKNRdH+2y4CtcxjbUY0Y4O+QhTzB0pxtLymehiwDv34D4DGZCIPoFG4+SgMjxG o6LPTXFYrTVCCVm12J/rHqr8htvu+Jf/gW7E3cYP+i57YZdxSIDbWpb X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_132833_867120_648E2CAD X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use the 'free(device_node)' macro to simplify the code by automatically freeing the device node, which removes the need for explicit calls to 'of_node_put()'. Signed-off-by: Javier Carrasco Reviewed-by: Chen-Yu Tsai --- drivers/input/misc/sparcspkr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index e484d79b5597..8d7303fc13bc 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -182,7 +182,6 @@ static int bbc_beep_probe(struct platform_device *op) { struct sparcspkr_state *state; struct bbc_beep_info *info; - struct device_node *dp; int err; state = devm_kzalloc(&op->dev, sizeof(*state), GFP_KERNEL); @@ -193,13 +192,12 @@ static int bbc_beep_probe(struct platform_device *op) state->event = bbc_spkr_event; spin_lock_init(&state->lock); - dp = of_find_node_by_path("/"); + struct device_node *dp __free(device_node) = of_find_node_by_path("/"); if (!dp) return -ENODEV; info = &state->u.bbc; info->clock_freq = of_getintprop_default(dp, "clock-frequency", 0); - of_node_put(dp); if (!info->clock_freq) return -ENODEV;