Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1030860rdb; Fri, 2 Feb 2024 11:10:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnkFk+AqgAjz3AmRTDA8YUgAShvbuRt3gTir4qc7oB48nSwLyRHQnJwpE9NAz7tPv74eBu X-Received: by 2002:a62:ce81:0:b0:6db:a1f9:a7b0 with SMTP id y123-20020a62ce81000000b006dba1f9a7b0mr2991652pfg.21.1706901054948; Fri, 02 Feb 2024 11:10:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706901054; cv=pass; d=google.com; s=arc-20160816; b=uKDxx5WhnM5lvphrg2Q5qfUlS4MzOMsydRVXZYeWce/RMHocQaroZbt8nwUKRAlPzl 7OMZMSXMqtMuYoGc3oczYhJqO9T43Sn0qxiG6PEUHtNnRfOZpQBKy0MBoLFNNmhN4Ovc LNByeKxl3PuagKGfmJ/7DDMwjyt1hUvsOZX8RzJEPEt8T3kV1r+FYQH9NzJeMHviygl7 JEaXSTxN+BufbdR6sgEiflwl1eRydEzr8FhmEhcUJuY6BXvZugK8Q35WdSqdCGu3awu6 orVsVOORPIRVVjzx8+Gz9r+0T6SxUnFcyIhuq5z/pNERD/XsxNn/yigLA2K3zYmy45pO O+sQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lwHFsR9igFcIPXKmJqsnMgVGlLrMRqn2qb3tuCliBlY=; fh=beCtt3nlXNklp6d2wAfVZ7DEwl/G/9rlDhn0ipbCusw=; b=niSAi5xIYqAsADIHZqoniz0GshHlKMb+YlZMSILacSlQxJbtF1JbNtCAYeqwov4XBw MZMZmDMzoz+yUYJLJNFGbH62zYsiQAud04wDJifNUpafUXzyHnwU+3w0yJDBZWaOrCBb 7fU1Ga+EdsHud9NIsWaJXRupIT1pJfvfFdj735eqRPZqr055QS8CpgAZR6yMu6ADJKVI SGeXYZfqGMWEjkWSKRry2WkKDkUomCRQZ3EjXMdPoIGzTZxQzuCLdiGsLFF3sOYziaSG TUIcvc+bXQYdHCp6j4lQQnsLNNjnJiAuhSE5R+PEwrMvcPb//Opsl5Ph0mA705DIEi+m yvLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ISGsmjgW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-50444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCUYd5Wc8vOwZm2cDDedrJOx89AGmN/ei9pGiwWQkZmWVYx859xy8ELgOqi2Er+3/oY2QuqnQzhBBVkvjQ+ekLIf52bEZKukYLUyEk5TYA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o14-20020a63e34e000000b005d8e221d9f4si1981340pgj.77.2024.02.02.11.10.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 11:10:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ISGsmjgW; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-50444-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5291029547C for ; Fri, 2 Feb 2024 19:05:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D56283A16; Fri, 2 Feb 2024 18:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ISGsmjgW" Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (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 9ADBB80626 for ; Fri, 2 Feb 2024 18:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706899543; cv=none; b=IFOVcDcSIX7W3GySbathdwPCda492Y8cBWy2LTmJ+yB0cWRI+7a5v9pHXzrWlUDCxhJ+QBukQttfm3w5QLxxtSRd+3wtDs55tQBIgmEKoElEDHX2a9vQw00kEgUGp0kN8GwPqkFFPGb6eiC3SoO4y97p0/kEnZWi+Lxy3U/8N7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706899543; c=relaxed/simple; bh=rBKu9aWpLQfoD/Jg07Ku9jg2NAxJPGNWxzDssmImpfE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=q1zWopc/qB/CQX6/tbE/XGUP1w9WhUh2cK1jKI7IpJYBwxcbAthIYC4KQoSVO7vBvCgpOu5dfVTsY/LLkrliiHDTeEnM1N9SiIX4k0X01iamd4EmTNweWMtOwew6OI+JR0c2oZ/08n5/OgvjT84RN790vy1LsyCs8lzk+LsAGnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ISGsmjgW; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a34c5ca2537so346545166b.0 for ; Fri, 02 Feb 2024 10:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706899540; x=1707504340; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lwHFsR9igFcIPXKmJqsnMgVGlLrMRqn2qb3tuCliBlY=; b=ISGsmjgWprSELr38UOGnFI1OzG5Fz7omJ7mJ7iMWd53PO3NIYgmbOIooFBwLVlldou fIaGGx6WU02MC4eGG8XaaYscP2HORX55sw9nYQ8Pnd5C5RBrqsO8Fz6ZJNfMfR587EbS xdpPxwwsBBxnzxR543AWL1/cxwZQ29aB0I8hWzR02y8Z+4vnG95hj+0CDEDpCyRLxFMP +3LDBCDoizjaZNekzUwyI5ixnrr4ultT1lECU57EVrMzHufV4L+IksOLgwmmFuF++MIh beaWDdcbeBDX0kgBIlaGddDA9jPyF/513R/IT3nw4B985nOoY+LYG0tRNpYYIXI7GMnY Lgcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706899540; x=1707504340; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lwHFsR9igFcIPXKmJqsnMgVGlLrMRqn2qb3tuCliBlY=; b=w2EhQdKWkU0YpdVtiWwIAFs7MmbNdSJ1SGqIt/Ar/DgCG17XOFqwp8Z5354Z2BuNAJ SRB7nEK3hVAT8LO+YOZGtBFIHZZX1TIHe8mq7+cVxqd3lqkaUFg9VqYh9r47vyZMjx7s 4wy4wpykQYeogGvwOkXwOu+zgbq2J0smfvAsqq86wUG6Wt1nmV8AsaOrMGjkN1SnRHrH C3BfEAHiZajcA0O4kxZE8mqPNInAA37YG+iKp0+TEX7M004g3Nj3mj12vNAjbfay95hj avmrRCnK04kygNkexN+VYPKysXLmZ8SVryXvyc8B3ojiy0yRQPZWkLTR1ZxjR6hvIc0H +D8g== X-Gm-Message-State: AOJu0YyuSlqM/Q1CB9wjHZjXwz93VR1QOkcqg9KxpF9n/85PhiIbCc2K b2+qe+K2PCwYiiZNuC6lEiAI5TXq8gtzzim3+96GXHoe2LyVNEjkEPujfdWkb8I= X-Received: by 2002:a17:906:7013:b0:a36:239:77a with SMTP id n19-20020a170906701300b00a360239077amr2129511ejj.23.1706899539714; Fri, 02 Feb 2024 10:45:39 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVc+L5266YrE7frcSaUyADns1YP9/8S/1kIzTLfB2FVrqjxF5mLD04WRC2ct+m4lRmhFNW4PaZClk3nwee9wQMLbq0nRUsScGtXq3QW0mrygn8hZi09VVgNwHoN6ZnLcELqRRyR0KRbovVUxB5BM4SFjz/5nFW21umrOEJQyO6lZ4wsIZE+8ANxNr66/z4dpwNv2SEJDxm88A34o3sDDbbqoJ53lOgQ5gP+EnQWjG0usBM1YJol0yEwYz3j2UzYb7WfnHM2/ghCUTaf4luIfV8Ha88n2e7yfur4kaWf8n+gKm3YeN911L043elkGKqAQLsCE9arnqVWjwHA7ZC0qOwj1mTYpxVB2/SDV4FA7+22Eg9rcH0UPrqnnhhJXPUwFyBVTZ2Uo7dSbFiFqAjOkh9qWSXvjTvsseytu8u6ZUK9V0t8n0EJLNjjNvt9i1Ay1EErCpPN0pJA85cX Received: from linaro.org ([62.231.97.49]) by smtp.gmail.com with ESMTPSA id mm15-20020a1709077a8f00b00a37319aadb0sm240100ejc.15.2024.02.02.10.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 10:45:39 -0800 (PST) Date: Fri, 2 Feb 2024 20:45:37 +0200 From: Abel Vesa To: Markus Elfring Cc: Kuan-Wei Chiu , Abel Vesa , Fabio Estevam , Michael Turquette , Peng Fan , Sascha Hauer , Shawn Guo , Stephen Boyd , kernel@pengutronix.de, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, LKML , cocci@inria.fr Subject: Re: [PATCH] clk: imx: scu: Use common error handling code in __imx_clk_gpr_scu() Message-ID: References: <20231210171907.3410922-1-visitorckw@gmail.com> <0e906ec6-fe73-4dbd-b555-a2c03b6e1030@web.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0e906ec6-fe73-4dbd-b555-a2c03b6e1030@web.de> On 23-12-22 10:23:13, Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 22 Dec 2023 10:05:32 +0100 > > Use another label so that a bit of exception handling can be better reused > at the end of this function. Please don't send patches as reply to other(s) patches. > > Signed-off-by: Markus Elfring > --- > drivers/clk/imx/clk-scu.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c > index e48a904c0013..4ca9dccf3d3b 100644 > --- a/drivers/clk/imx/clk-scu.c > +++ b/drivers/clk/imx/clk-scu.c > @@ -882,19 +882,19 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na > return ERR_PTR(-ENOMEM); > > if (!imx_scu_clk_is_valid(rsrc_id)) { > - kfree(clk_node); > - return ERR_PTR(-EINVAL); > + ret = -EINVAL; > + goto free_clk_node; > } > > if (!imx_clk_is_resource_owned(rsrc_id)) { > - kfree(clk_node); > - return NULL; > + ret = 0; > + goto free_clk_node; > } > > clk = kzalloc(sizeof(*clk), GFP_KERNEL); > if (!clk) { > - kfree(clk_node); > - return ERR_PTR(-ENOMEM); > + ret = -ENOMEM; > + goto free_clk_node; > } > > clk->rsrc_id = rsrc_id; > @@ -922,6 +922,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na > ret = clk_hw_register(NULL, hw); > if (ret) { > kfree(clk); > +free_clk_node: > kfree(clk_node); > hw = ERR_PTR(ret); > } else { > -- > 2.43.0 >