From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 80F8618FDBD; Sat, 30 May 2026 18:45:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166755; cv=none; b=NxNvEjH+iOxsODM3kTpgz0ljZB6K0LpEiq/JXthorN8koaZE0JReHOspmhsF6RM6OUWCa847D2N+CrIc+KxAsf1OGBGkQDLJEdnmFY5xjH54y+/CaY8qcdpWNLhxrKvj0Bgel/ommfNDuoKpSrz4GxCNvGdrLDFCMQpmY6EUTkI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166755; c=relaxed/simple; bh=IIJYO+CIhH0O6Fc8d7HFBXoLLib6W+dergiTtGE+jzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U+sHngbeOTJEegRdJ/Qfutsxokq0XHPy7CIs5NJxNImI7WO4Z7JN4tHHO5V9clgLtGKzDJKy3tCUOsOHptW2eMXIyHst58JfeWeWeHljaImhF1rS2dNcJgy2QGw0pwNciDK2nIxcyeBnwdI1/UYyNyVHq6ZplStQoOuJJpRPTaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fBLwVKx9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fBLwVKx9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC04E1F00893; Sat, 30 May 2026 18:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166754; bh=TQKSkYRUmVbDArQqQ4OVJ5mFt0QkCKE88+e7eQ4NG8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fBLwVKx9mtqfu3+WuatSWneO32XQ+kbkHECGGwT/dyHat+8xvv+SIH3RnpyiL7Plt sFE9VPFW3QqkbVOKSQDcr6TOqZoa9L9Gq6eIhKkN/56QWoLMc5kjiD7zX+cNFsbWw8 fqHBkqvNrreriO7X6g0u6T5eu6fsrIXGT/mhUfD4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wolfram Sang , Jassi Brar , Sasha Levin Subject: [PATCH 5.10 461/589] mailbox: mailbox-test: initialize struct earlier Date: Sat, 30 May 2026 18:05:42 +0200 Message-ID: <20260530160236.787212039@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wolfram Sang [ Upstream commit bbcf9af68bfedb3d9cc3c7eae62f5c844d8b78b9 ] The waitqueue must be initialized before the debugfs files are created because from that time, requests from userspace can already be made. Similarily, drvdata and spinlock needs to be initialized before we request the channel, otherwise dangling irqs might run into problems like a NULL pointer exception. Fixes: 8ea4484d0c2b ("mailbox: Add generic mechanism for testing Mailbox Controllers") Signed-off-by: Wolfram Sang Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-test.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c index 247e83af060e3..41efe64976598 100644 --- a/drivers/mailbox/mailbox-test.c +++ b/drivers/mailbox/mailbox-test.c @@ -365,6 +365,12 @@ static int mbox_test_probe(struct platform_device *pdev) if (!tdev) return -ENOMEM; + tdev->dev = &pdev->dev; + spin_lock_init(&tdev->lock); + mutex_init(&tdev->mutex); + init_waitqueue_head(&tdev->waitq); + platform_set_drvdata(pdev, tdev); + /* It's okay for MMIO to be NULL */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); tdev->tx_mmio = devm_ioremap_resource(&pdev->dev, res); @@ -396,12 +402,6 @@ static int mbox_test_probe(struct platform_device *pdev) if (!tdev->rx_channel && (tdev->rx_mmio != tdev->tx_mmio)) tdev->rx_channel = tdev->tx_channel; - tdev->dev = &pdev->dev; - platform_set_drvdata(pdev, tdev); - - spin_lock_init(&tdev->lock); - mutex_init(&tdev->mutex); - if (tdev->rx_channel) { tdev->rx_buffer = devm_kzalloc(&pdev->dev, MBOX_MAX_MSG_LEN, GFP_KERNEL); @@ -415,7 +415,6 @@ static int mbox_test_probe(struct platform_device *pdev) if (ret) goto err_free_chans; - init_waitqueue_head(&tdev->waitq); dev_info(&pdev->dev, "Successfully registered\n"); return 0; -- 2.53.0