Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1323118rdb; Mon, 19 Feb 2024 11:15:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQqow9g5z8/Dw4IOe3fR88jTbmzAjPYFWCoN53YQfetRqeaFC+CRly9UYoP8AjlRZkdXRLPAZkAbm3MkRKvIx2oLQ+Lhfn502bDfwlrA== X-Google-Smtp-Source: AGHT+IFQ6AMqylthliiLvDI6hCQwo+HN2eBZHoGIHiL7XonkG3kWIp4xyjkRMg7Ei8KzBWDY1tFi X-Received: by 2002:a05:6214:2d41:b0:68f:de6:f123 with SMTP id na1-20020a0562142d4100b0068f0de6f123mr25196398qvb.6.1708370104632; Mon, 19 Feb 2024 11:15:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708370104; cv=pass; d=google.com; s=arc-20160816; b=fSCSwupFuPtZRW7mOy/AP7dPQdL2L2J2k9IO/WWn1CDffVMW/nfY/EioubyAcr085q WoNUPurnUgn7m5gFtun2wl1LuQO1GNZ7RsDjvVInEiTVEB78It5RjvwLyHCegVTWCc6s Z92p4Udz2PItvXg37yD8J0mUs+yBDgQHRxtCc9Iy3NvSKLO0gQo4ZiABsSdtghBaPuyP DezuoGDz1sIyhsKKIk1Dp2Ufrvg8KwPu9QfdAKCwQ8HTsB7u2dLSNr9WsTFuDyUfmmZM 89Dtr5jEPmZ43EIQs+FV/+/sy517652FvmjknLb3MzyLn6LUhh59DRtUXGLSxml9W5GT qzJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VB+6fLmhHNABLeH7tgIk1N9S8wbP0zr1KUAw/Vz7X9U=; fh=XncEHX10E/rR5nOqok7iwSkeAN7IGWP60Rf1UsdqkJ8=; b=N8DcvkluIzfOY9Mq1Qa25nOhUxWt62VkI7E7ys/4tTUES7/tzMD7EwvKJiL9gvz/OZ 6hjjG/D244BRxFfNuqlaPkiGXKmZd6DcB4MYwsWkbmUJZ5fuZCgsKNR3fg0F5ti5Of1t xhs/UFApqs3Dv2ukdj65mCrtLcTadN3ospgitm5vofAIXCsRnO62hKBstUASvrDutF2U N/CNhiMBn8Eu0Y8E4Bq6h+narr9Yb6nkbhfiPgl6VKCjOlbXUOmf/ZSx4Bg0zYgpOMc8 1l69853faw9SVkyL2hz8eK8n3YymW95SCZ5jhZaipDp2XWtme+Ighm1cpCskCyILMQd2 jUfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oom1n7lv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r17-20020a056214125100b0068f2eed6059si6924569qvv.234.2024.02.19.11.15.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:15:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oom1n7lv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 57E6D1C21393 for ; Mon, 19 Feb 2024 19:15:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE28F50277; Mon, 19 Feb 2024 19:14:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oom1n7lv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E4E6347F7E; Mon, 19 Feb 2024 19:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708370095; cv=none; b=htvwsISvZ/SZokX4nrueo+9kQcbtCiJSL34lZY2bmJ2xCAuFeJXqGbaJcEo8AKFJ8pxcnMmb8hg43hfUNk6X+TzgEZ2xm6qxDnZWQqf30v5K6RAFya5JNL3X78xaXuXy8LwTtfBaCoBqc1/CkaxHs/caEn7kmjMswks65Pmrfig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708370095; c=relaxed/simple; bh=QTBG/aGzAOq3/rChRUOGGC1heGIPVEN2ILRn4fyBPaI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ahh79H8Fea/ne//OilgGusDP3Ci070V5LMwPdWMMAbD2i4HeFVizKL19JFQnG+AlsnLeDQyANbu54Z7Kv5wZC9e05i91NUfufuxZAGREk+y9BZ1XIDYAQ1LfaIsMNMNl8WtwPYqega7wtsXqdBv16YsVO4b7N11jmOSFQVHkXVw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oom1n7lv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDD0C433C7; Mon, 19 Feb 2024 19:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708370094; bh=QTBG/aGzAOq3/rChRUOGGC1heGIPVEN2ILRn4fyBPaI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oom1n7lvtXC1D4z0OR2TpVTNMA8sRzwh5TLdnrF1pWTGRKLZwxUC6KwKh5pPvnFjg ZRTzJzM44PKQaZ8NsNWzSPaeM0OJ48nCXXg03+ss3EkM1DtBnppjM+FhGK70aH7fKM yy7AlkvB7HU7ZWhzlH14GtEMlPOwIz2jeaiERCABY8hWsCxaxXKHxI6CTrhTwkTFEn bEvfp6vkLQHMYv2gyhJ0oVKxYKTR0SiefOZmRyPluDK2/E8PEPR7lg3jCYBDukPKnt Vw2Fn90Gyt7000pEsJWkrgg6aPQRGiXN6DasBn1N7WaKa04qXrl8nyMj5ZajHaKCvQ 2LTU6b6bOEzEw== Date: Mon, 19 Feb 2024 20:14:47 +0100 From: Niklas Cassel To: "Pandey, Radhey Shyam" Cc: Markus Elfring , Damien Le Moal , Jens Axboe , "Simek, Michal" , Philipp Zabel , "linux-ide@vger.kernel.org" , "kernel-janitors@vger.kernel.org" , LKML , "git (AMD-Xilinx)" Subject: Re: [PATCH v3] ata: ahci_ceva: fix error handling for Xilinx GT PHY support Message-ID: References: <9427c0fd-f48a-4104-ac7e-2929be3562af@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hello Radhey, Markus, On Mon, Feb 19, 2024 at 06:42:49PM +0000, Pandey, Radhey Shyam wrote: > > -----Original Message----- > > From: Markus Elfring > > Sent: Monday, February 19, 2024 9:27 PM > > To: Niklas Cassel ; Pandey, Radhey Shyam > > ; Damien Le Moal > > ; Jens Axboe ; Simek, Michal > > ; Philipp Zabel ; linux- > > ide@vger.kernel.org; kernel-janitors@vger.kernel.org > > Cc: LKML ; git (AMD-Xilinx) > > Subject: Re: [PATCH v3] ata: ahci_ceva: fix error handling for Xilinx GT PHY > > support > > > > > > Platform clock and phy error resources are not cleaned up in Xilinx GT > > PHY > > > > error path. > > > > > > > > To fix introduce the function ceva_ahci_platform_enable_resources() > > … > > > Applied: > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/log/?h=for- > > 6.8-fixes > > > > The error code “-EINVAL” was set before the statement “goto > > disable_resources” > > multiple times in the adjusted implementation of the function > > “ceva_ahci_probe”. > > I suggest to add a jump target so that a bit of exception handling > > can be better reused at the end of this function. > > > > > > How do you think about to apply the following script for the semantic > > patch language (Coccinelle software) accordingly? > > > > > > @replacement1@ > > identifier rc; > > @@ > > <+... > > if (...) > > { > > ... when != rc > > - rc = -EINVAL; > > goto > > - disable_resources > > + e_inval > > ; > > } > > ...+> > > return 0; > > + > > +e_inval: > > +rc = -EINVAL; > > disable_resources: > > ahci_platform_disable_resources(hpriv); > > > > @replacement2 disable neg_if, drop_else@ > > identifier replacement1.rc; > > statement is; > > @@ > > if (...) > > is > > else > > { > > ... when != rc > > - rc = -EINVAL; > > goto > > - disable_resources > > + e_inval > > ; > > } > > > > > Thanks for the suggestion. However, taking a look at the existing implementation > i think we should return error code *as is * from of_property_read() APIs. > and get rid of rc=-EINVAL reassignment itself. > > If it sounds ok, I can add it to my to-do list and send out a patch. Sounds good to me. Kind regards, Niklas