From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 178EE38F25D for ; Wed, 8 Apr 2026 12:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775649756; cv=none; b=JZSdB/WkEAXnQJngtmjL8eRnTK7VrhNe9mjIs633TRPO6AQgudlDpryl95EV8km7FgbjeFVm440gefRCKoPb4wIrgitLrBLYH2oIGw5L7VfCpxbxd6cjWnf8K31Q1z8pzOe/bW8aLxejeINVmDgSaOw3RZOzxVuflQL461jENhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775649756; c=relaxed/simple; bh=aFUbtpt9Tomu9YSEge6zlhFTW2jyhVQ/M5oB3NWYB/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZL2mZH4Dh39tqiOYfxSWQezpMbwaSLshnYvXyg+tH7Td2VZoV76i+BzMUPFtEDjCjklUtDbgXa9Kn5zRJ//GnIwZMknujHX3uH7lJKVlBTjBIoNjsSHA12Riqx6g/SMQLt6MxgyfgnfvBu4yaImti6BdWsFzHiTnjLRlfN4fudQ= 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=QuKvpYEl; arc=none smtp.client-ip=209.85.210.180 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="QuKvpYEl" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82cdb4ab547so3030235b3a.2 for ; Wed, 08 Apr 2026 05:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775649754; x=1776254554; 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=HxF/5xyzxh7moQ/DzCaZduABbVHgNK2NM9rE5Y5cP+w=; b=QuKvpYElVZbRx0NVRR+UddSGLkzRWCWopPPXTzkGt5appvTzkHONmI6ggswgPhxDhe dCrB3MfvZaczQrEB03Bw8qXrb2TUr0Qg9LFi/mNG0n/naKxWXQlRYKBxNWE8GUA4wOdm 76ascwpdF7NkVRAB6yLB5Jd9qAU8u7bOisj3OIC70lN6nfstbJgJMAO9X/9YKccic5i5 g5EPhSwhv0YfP1gHFOERHOVoupCCjLDwmk0nUITIrHUHJ5qaDGfkeNZc33i65zIw6g9/ Sba0e7eFOcr+k7huKCijikIXs/QL2OLoEWIJ/Y8rc4CHRABZD+G7b7bYl6eK7jHpLyn0 fyZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775649754; x=1776254554; 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=HxF/5xyzxh7moQ/DzCaZduABbVHgNK2NM9rE5Y5cP+w=; b=iUN1h3n3K2c4Sm47F+9K7D1QfKC4nULpRxRCeXKKEYmUxadV8Sj8MHUHJGLhcKX00O CE/B3mfluTo9Lul+xLdk4c6ZdO7kkkuKagUmml7FUHx9CO7VmD9bYuYOzVK1pmJtsekk Jb/eNoV8F2fyf50lsmJlCGDw9vpUA46cF0NCa67eIPL7x9/BB5wCx3bfPNgh0zs9CklW i6XzpUA5pfSNqpwrntBzWcDWayOrO6kuPrLfSK+RfvcFjj9yoiszPbcTYcHDFiQzkSER QaVixrNo/Og/jy7JF9H0tbU8RQwV+ixMolyUhUHG93CZRoC2cyOcmVzu05rNpM40+g0h PjKw== X-Forwarded-Encrypted: i=1; AJvYcCUMB2JvBP6X+Lw/POjZbuR2A+0bn2Q2SACxIUmxowpD8FF8T7LsO1y7VUtnMi+T8M33plerus35QVbCb2M=@vger.kernel.org X-Gm-Message-State: AOJu0YyS830B7lEUr0A1qf0/wUJtc6eLGtBPVmmLstPokG4azvH3KN+K j+9UHlwfEbW1G5D98ZVy0+MEO3x9JwV9vbmAvm5dmO1GfGWBoZ4MNJqwODVbeA== X-Gm-Gg: AeBDiethq3OLiSh+zW9cpCMYDsLJZ1JN16VZ4CpO7+QWT3JB/+X1IhS062G0RzI3TI3 UpfP7tXDeQ+2ITgWCq5mU6xPpY25RZREtX3Ul7bH2BW/LLUEW2AimUSC/pKo5S02BvwriqzS2yD 9UnvftmlBKZZc3R5mBUDt6EdIS3XrnY6IMTFzjK5+ioGgMM5M9ksmBPRZhL1YyokEsvtT5x/O8P FsEHV0hdQrSzdPNHZI3LMPFF/dV78x5n0mBcdKh7nGmRJ93Lv0htjgGp/LR03OPvqjLwnGIdf3K /cckvdtg8r5eMlFmBqnvaItUk3SFpO9QFUQN6aglvqJKKWOD7qlaEqsgjdyVdBFI76uOQJRZYn3 UmIopKwk9EC4TUzkfbwbFoWSliXtFozHHJddD00BuKEo4XGDhblK5MOd7MeGcdy4+6Qjz05N8/X /WcqaR0ZsLmpvzHXlo5DHNbFzH+B5VJnGmiOwG62EKQc4u5z4ch/COGYw= X-Received: by 2002:a05:6a00:3e12:b0:82c:7876:a03e with SMTP id d2e1a72fcca58-82d0da8f384mr20097042b3a.17.1775649754432; Wed, 08 Apr 2026 05:02:34 -0700 (PDT) Received: from Mac.localdomain ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82cf9b3e169sm21209322b3a.18.2026.04.08.05.02.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Apr 2026 05:02:33 -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)" Subject: [RFC v2 10/10] pseries/papr-hvpipe: Fix error handling in case of init routine fails Date: Wed, 8 Apr 2026 17:31:40 +0530 Message-ID: <3ff4de80fce72914eff23a169c974786858517e1.1775648406.git.ritesh.list@gmail.com> 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 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(). Signed-off-by: Ritesh Harjani (IBM) --- arch/powerpc/platforms/pseries/papr-hvpipe.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c index c708869ca732..b6d0b36915c6 100644 --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c @@ -785,18 +785,20 @@ static int __init papr_hvpipe_init(void) if (ret) goto out_wq; - ret = set_hvpipe_sys_param(1); + ret = misc_register(&papr_hvpipe_dev); if (ret) goto out_wq; - ret = misc_register(&papr_hvpipe_dev); + ret = set_hvpipe_sys_param(1); if (ret) - goto out_wq; + 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: -- 2.39.5