From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 665F5311597 for ; Fri, 1 May 2026 04:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608754; cv=none; b=Bm34reSkfbEOpFgumrJtt5lBUYESTa2qSLR52TJERJUz3sDn3DgTphYWXzetYzTEHII189qM3JgAyCrBELlyoolKS6NpWK7s51WRaUdKMy5wXTvLM4Bfwqc2Y9zOZKX5oBvadpQ8Z+XsNejH33CvZkcQ/O+okFtMVGtaX5Hjp9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777608754; c=relaxed/simple; bh=+Oi12GzLgtByjEF2wRqsc0NBBF8vvCA6FOOChN791o4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a7ll/f5ji1Mu/E1WkirTm3J5N7BSOSRvNaB8ArJnND+CbtdOfb2je31ms/KxQjNtMGjiSavCWhfJJyE5R4odhynciXLNyfupbuQUW67Ki/wp1Sm735oHTRRuTXesYIBWVPOQykNPAVVNht509BTpLN9TYKO72B5HqyQWpi2cbdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gNFNez8+; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gNFNez8+" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-8318293f02bso932323b3a.0 for ; Thu, 30 Apr 2026 21:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777608753; x=1778213553; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FX+puozfKOk6l+f90pyqn7buO5CtmALr+6nyHUFvWvA=; b=gNFNez8+daeJEil9I/I4OboxepyBpMBbU/dBC7yphmqAUNCG2cOF2THHrsd0cYbe6m 53hJHb+HmmHhJCHTwTnSftzf0scBXeRobEm6uVRt8Y3xh/Hq91WIZdH32CgYMQswhBmm oyaGNUWOaBlH3wVJgQ8bjcfLU4rpHFrJyKJUuL3LoJ6pwOqnAlkm6HOUmgHsbYBFFNL5 WbnWgstYh/tyNPCI1NAgjNSVbJYAnJLiyB/EddPPHtNVEpwPS7pxEJXeW0UMpuoNWTl2 lzG4cJb3hVUI3+TkKB4JLtPhHCTWOWm/isOHSA0JhL8NA9Vl27x5pHWQUaPbcn7HdNRo RCgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777608753; x=1778213553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FX+puozfKOk6l+f90pyqn7buO5CtmALr+6nyHUFvWvA=; b=ELUDHaBNSBvWdlb/JxZhDPdmzPX4Ol1rG3bN09O+5ICKEE7Zt11bpuzEPWmbpNGo83 GVRo5lYimFt0kzQ98besNR/neJZxblzyrXezGWfh+/e8xrsLFpAkQBQxGI+GlngwpePO bkqh+7mU4o1PNgCqCdOjaKI9/F5rgTSZaM9Ljz2u+pspdfZlq7Jkhxd9ma5yu4745QSi GFoeqOLo91Nkwfq5Qi1a/PiLH94y75uCmtBBidNRc7rCz53V92+HYeIomdH0LGVDlvJu EioNNrDkoBSsKD4F2NqgS/MVr6kKvT6LfB6nvgvMsqFH2Zi4P0hEJ0msW4+Gjzm5v2aO 42Vg== X-Forwarded-Encrypted: i=1; AFNElJ/aqqzemhxvH9sK2tEh/+9IsJVHePQSI7A8sD2QXv8yn5cJW7/2oQamTlumbIS+9j1SLlVBRz1gFUqf1cg=@vger.kernel.org X-Gm-Message-State: AOJu0YwF58ca3CZ5BP7JQQHQz5ec36xxacW9xkX3cduxqEOUAbCnr/WN uYqnCPLnddmyfyl92/ZCol6KCwsatIZPHzK8j2Ow5quhZo5tP4FkL7Q4 X-Gm-Gg: AeBDiesnLEi6pVg1KDISMYcOHH7n8MoxkSG7ElfRZngecvrSFe+8BeR+petx3Ircb+H T1Do+PqpKgAUNEHumlgzzpLS6F98iImJYDC6709iM53IylqBl1FkgKl+WRGJHbVAV5Imin+JPnv XwgJsof32w6q36l6tHzmMC/65r/JysM6kmYh8wmS7pl5tqeNjRshqPSeFnQj4qLlqqxgOLsT7kW QMz3KU5PuTmLvTbH2npJ5i1bguYa09dSF7drQ4i8narY0JkHWdyrkMzr846a2S7VKJazPLoFG/A PbhJ9L3uAXCS15K4w3X3BfZ7UjHo3XSllEVFUlWkfGmxvaguyGjMXmXXLgCdr6QxFk99uU1G9j2 K44M/3aXfnQpdhxpeA7Vqw5wYNhid4qTaIMdS/eIXLJNknhj3wASPr0qmS4Ecw4BI3kDgdM2lcA PjSh8WMpA3OKlOasRaJBLgW5etVBpjEmQHqxF/v9wifAkhBsCuPBKQX23pDHMn7ccUNdr+lcHOA Q== X-Received: by 2002:a05:6a00:3e27:b0:82f:3774:4fdc with SMTP id d2e1a72fcca58-834fff78b31mr5164676b3a.1.1777608752763; Thu, 30 Apr 2026 21:12:32 -0700 (PDT) Received: from localhost.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 30 Apr 2026 21:12:32 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linuxppc-dev@lists.ozlabs.org, Haren Myneni Cc: Madhavan Srinivasan , Christophe Leroy , Venkat Rao Bagalkote , Nicholas Piggin , linux-kernel@vger.kernel.org, "Ritesh Harjani (IBM)" , stable@vger.kernel.org Subject: [PATCH v3 4/9] pseries/papr-hvpipe: Fix & simplify error handling in papr_hvpipe_init() Date: Fri, 1 May 2026 09:41:43 +0530 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Remove such 3 levels of nesting patterns to check success return values from function calls. ret = enable_hvpipe_IRQ() if (!ret) ret = set_hvpipe_sys_param(1) if (!ret) ret = misc_register() Instead just bail out to "out*:" labels, in case of any error. This simplifies the init flow. While at it let's also fix the following error handling logic: We have already enabled interrupt sources and enabled hvpipe to received interrupts, if misc_register() fails, we will destroy the workqueue, but the HMC might send us a msg via hvpipe which will call, queue work on the workqueue which might be destroyed. So instead, let's reverse the order of enabling set_hvpipe_sys_param(1) and in case of an error let's remove the misc dev by calling misc_deregister(). Cc: stable@vger.kernel.org Fixes: 39a08a4f94980 ("powerpc/pseries: Enable hvpipe with ibm,set-system-parameter RTAS") Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c index 402781299497..800649f309a5 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -780,23 +780,29 @@ static int __init papr_hvpipe_init(void) } ret = enable_hvpipe_IRQ(); - if (!ret) { - ret = set_hvpipe_sys_param(1); - if (!ret) - ret = misc_register(&papr_hvpipe_dev); - } + if (ret) + goto out_wq; - if (!ret) { - pr_info("hvpipe feature is enabled\n"); - hvpipe_feature = true; - return 0; - } + ret = misc_register(&papr_hvpipe_dev); + if (ret) + goto out_wq; - pr_err("hvpipe feature is not enabled %d\n", ret); + ret = set_hvpipe_sys_param(1); + if (ret) + goto out_misc; + + pr_info("hvpipe feature is enabled\n"); + hvpipe_feature = true; + return 0; + +out_misc: + misc_deregister(&papr_hvpipe_dev); +out_wq: destroy_workqueue(papr_hvpipe_wq); out: kfree(papr_hvpipe_work); papr_hvpipe_work = NULL; + pr_err("hvpipe feature is not enabled %d\n", ret); return ret; } machine_device_initcall(pseries, papr_hvpipe_init); -- 2.39.5