From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AF22C433F5 for ; Sat, 15 Jan 2022 22:25:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 63A33834B5; Sat, 15 Jan 2022 23:25:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ot6LcubQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B746183520; Sat, 15 Jan 2022 23:25:23 +0100 (CET) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 40F4383518 for ; Sat, 15 Jan 2022 23:25:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x833.google.com with SMTP id q14so14631403qtx.10 for ; Sat, 15 Jan 2022 14:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qeAWQwPHJYMg1gJSe2iE4KryNVX0uE0y/rrr1LDznz8=; b=ot6LcubQLLQOdv5OcKtHF3g54gRxojuITYbm2jfpVBKEkNhO2t3uPw2/cccUC+GM+Z i1h5yhpV/PTZKKLPqIeLw90kUML1GKY6FpRUIIoM4pVGjo8ZY2gqSxy2/uR3lyxXtN+N aR4Va6b4OeraEVM81lpnPXFvF0EYG2+YMt7nStC8lHk33Ji5MEXYtPKt1HnsOZbzmaN3 suGuAX5wwSJSTcjTa9RUq8IqYpDXTFCO3JxeeO70iY5xAi7brPJaoBU6Xqmjw3WOhc09 n7kJNpKTQqWYt9kN96qCgvUMLlS2X1NmFX/aF8nNjextJDz7wk1dhnM74sL3mNuUVczf 8qZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qeAWQwPHJYMg1gJSe2iE4KryNVX0uE0y/rrr1LDznz8=; b=ZTk2aYCQL7RvgP6GCwhkfmKHVQWN/SSphex3J4QwjKlRRKT+44RDJFDoTioYl3Dw8r CxVtNtnZcuHlmftWhszbujk91FXf9pdj2Te7KdmTvfxfnkbXBhZGZmn96RIRaE2IBCv5 Pgt5K6SC1FIcSCOzu4pUxQMGexApW6BiOYHjRQ+RyoU91sCt8VWSGXxZrEYtQ+C026M3 F14iuDLSxPF1PvDCy2oGtqnv2Zn60sMkL3l+63u41CoUCvKpT7UFHG+35+uOsUVg6X/t /1KodNZOhtpOtx9XCJpKIpxhI4lZPylt6goLq/LMsrZEIWetrDrp+PPKMcLZKLRT3h2N uUJg== X-Gm-Message-State: AOAM531mW1sohayJisi+g6/4fdhM4Vt/R0arUXb/twQ6qnagakdjNw4K 0Jgqm82DXgyZ/9A0C64oQw/pHqsn3gs= X-Google-Smtp-Source: ABdhPJxENi7XTjciV9oX+/yPmh/tfVV4oyqGoyK1zx+zdB04Y9gd8oGyeEZtk1QvepgSXl50zBTHFw== X-Received: by 2002:a05:622a:1894:: with SMTP id v20mr2752747qtc.148.1642285514794; Sat, 15 Jan 2022 14:25:14 -0800 (PST) Received: from godwin.fios-router.home (pool-108-18-137-133.washdc.fios.verizon.net. [108.18.137.133]) by smtp.gmail.com with ESMTPSA id ay15sm5991017qkb.63.2022.01.15.14.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jan 2022 14:25:14 -0800 (PST) From: Sean Anderson To: u-boot@lists.denx.de Cc: Simon Glass , Lukasz Majewski , Sean Anderson Subject: [PATCH 1/7] clk: Make rfree return void Date: Sat, 15 Jan 2022 17:24:58 -0500 Message-Id: <20220115222504.617013-2-seanga2@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220115222504.617013-1-seanga2@gmail.com> References: <20220115222504.617013-1-seanga2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean When freeing a clock there is not much we can do if there is an error, and most callers do not actually check the return value. Even e.g. checking to make sure that clk->id is valid should have been done in request() in the first place (unless someone is messing with the driver behind our back). Just return void and don't bother returning an error. Signed-off-by: Sean Anderson --- drivers/clk/clk-uclass.c | 7 +++---- drivers/clk/clk_sandbox.c | 6 +++--- include/clk-uclass.h | 8 +++----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index fca4b8321a..61f977b661 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -481,10 +481,9 @@ int clk_free(struct clk *clk) return 0; ops = clk_dev_ops(clk->dev); - if (!ops->rfree) - return 0; - - return ops->rfree(clk); + if (ops->rfree) + ops->rfree(clk); + return 0; } ulong clk_get_rate(struct clk *clk) diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c index 57acf7d855..636914db8c 100644 --- a/drivers/clk/clk_sandbox.c +++ b/drivers/clk/clk_sandbox.c @@ -101,15 +101,15 @@ static int sandbox_clk_request(struct clk *clk) return 0; } -static int sandbox_clk_free(struct clk *clk) +static void sandbox_clk_free(struct clk *clk) { struct sandbox_clk_priv *priv = dev_get_priv(clk->dev); if (clk->id >= SANDBOX_CLK_ID_COUNT) - return -EINVAL; + return; priv->requested[clk->id] = false; - return 0; + return; } static struct clk_ops sandbox_clk_ops = { diff --git a/include/clk-uclass.h b/include/clk-uclass.h index e44f1caf51..65ebff9ed2 100644 --- a/include/clk-uclass.h +++ b/include/clk-uclass.h @@ -32,7 +32,7 @@ struct clk_ops { int (*of_xlate)(struct clk *clock, struct ofnode_phandle_args *args); int (*request)(struct clk *clock); - int (*rfree)(struct clk *clock); + void (*rfree)(struct clk *clock); ulong (*round_rate)(struct clk *clk, ulong rate); ulong (*get_rate)(struct clk *clk); ulong (*set_rate)(struct clk *clk, ulong rate); @@ -81,11 +81,9 @@ int request(struct clk *clock); * rfree() - Free a previously requested clock. * @clock: The clock to free. * - * This is the implementation of the client clk_free() API. - * - * Return: 0 if OK, or a negative error code. + * Free any resources allocated in request(). */ -int rfree(struct clk *clock); +void rfree(struct clk *clock); /** * round_rate() - Adjust a rate to the exact rate a clock can provide. -- 2.34.1