mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure
@ 2026-10-21  3:02 LiuJunyuan
  2026-10-21  5:57 ` Dan Carpenter
  2026-10-21  6:17 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: LiuJunyuan @ 2026-10-21  3:02 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, LiuJunyuan

Assign bridge->crcsr_bus only after bridge->crcsr_kernel has been
successfully allocated.

Signed-off-by: LiuJunyuan <2058432396@qq.com>
---
 drivers/staging/vme_user/vme_fake.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
index 434cf760ade6..5a4e61d20479 100644
--- a/drivers/staging/vme_user/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -1029,9 +1029,9 @@ static int fake_crcsr_init(struct vme_bridge *fake_bridge)
 
 	/* Allocate mem for CR/CSR image */
 	bridge->crcsr_kernel = kzalloc(VME_CRCSR_BUF_SIZE, GFP_KERNEL);
-	bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
 	if (!bridge->crcsr_kernel)
 		return -ENOMEM;
+	bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
 
 	vstat = fake_slot_get(fake_bridge);
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure
  2026-10-21  3:02 [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure LiuJunyuan
@ 2026-10-21  5:57 ` Dan Carpenter
  2026-10-21  6:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-10-21  5:57 UTC (permalink / raw)
  To: LiuJunyuan; +Cc: gregkh, linux-staging, linux-kernel

On Wed, Oct 21, 2026 at 11:02:22AM +0800, LiuJunyuan wrote:
> Assign bridge->crcsr_bus only after bridge->crcsr_kernel has been
> successfully allocated.
> 
> Signed-off-by: LiuJunyuan <2058432396@qq.com>

The original code is done intentionally.  I'm not sure if the
new version introduces a bug because I haven't looked at the
surrounding code.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure
  2026-10-21  3:02 [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure LiuJunyuan
  2026-10-21  5:57 ` Dan Carpenter
@ 2026-10-21  6:17 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-10-21  6:17 UTC (permalink / raw)
  To: LiuJunyuan; +Cc: linux-staging, linux-kernel

On Wed, Oct 21, 2026 at 11:02:22AM +0800, LiuJunyuan wrote:
> Assign bridge->crcsr_bus only after bridge->crcsr_kernel has been
> successfully allocated.

Why?  There's nothing wrong with the original code.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-21  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21  3:02 [PATCH] staging: vme_user: fix crcsr_bus assignment on allocation failure LiuJunyuan
2026-10-21  5:57 ` Dan Carpenter
2026-10-21  6:17 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®