Skip to contentSkip to conversation

ipmi: kcs: Fix aspeed_kcs_probe_of_v1()

PATCH In review Dan Carpenter 4 participants 4 messages Apr 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipmi: kcs: Fix aspeed_kcs_probe_of_v1()

This needs to return the newly allocated struct but instead it returns zero which leads to an immediate Oops in the caller.

Fixes 09f5f680707e ("ipmi: kcs: aspeed: Implement v2 bindings")
---
 drivers/char/ipmi/kcs_bmc_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/kcs_bmc_aspeed.c +1 -1
index 9422d55a0476..a140203c079b 100644
@@ -271,7 +271,7 @@ static struct kcs_bmc *aspeed_kcs_probe_of_v1(struct platform_device *pdev)
 	kcs->ioreg = ast_kcs_bmc_ioregs[channel - 1];
 	aspeed_kcs_set_address(kcs, slave);
 
-	return 0;
+	return kcs;
 }
 
 static int aspeed_kcs_calculate_channel(const struct kcs_ioreg *regs)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Dan Carpenter

This needs to return the newly allocated struct but instead it returns zero which leads to an immediate Oops in the caller.

Thanks, this is applied.

-corey

Quoted 23 lines
Fixes 09f5f680707e ("ipmi: kcs: aspeed: Implement v2 bindings")
---
 drivers/char/ipmi/kcs_bmc_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/kcs_bmc_aspeed.c +1 -1
index 9422d55a0476..a140203c079b 100644
@@ -271,7 +271,7 @@ static struct kcs_bmc *aspeed_kcs_probe_of_v1(struct platform_device *pdev)
 	kcs->ioreg = ast_kcs_bmc_ioregs[channel - 1];
 	aspeed_kcs_set_address(kcs, slave);
 
-	return 0;
+	return kcs;
 }
 
 static int aspeed_kcs_calculate_channel(const struct kcs_ioreg *regs)
Signature · 1 line
2.25.1
maintainer
#2 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

This needs to return the newly allocated struct but instead it returns zero which leads to an immediate Oops in the caller.

Fixes 09f5f680707e ("ipmi: kcs: aspeed: Implement v2 bindings")

Thanks for the fix Dan.

Andrew, I think this means no one has used the v1 bindings in mainline, so could remove that code?

Quoted 20 lines
---
 drivers/char/ipmi/kcs_bmc_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/kcs_bmc_aspeed.c +1 -2
index 9422d55a0476..a140203c079b 100644
@@ -271,7 +271,7 @@ static struct kcs_bmc *aspeed_kcs_probe_of_v1(struct platform_device *pdev)
        kcs->ioreg = ast_kcs_bmc_ioregs[channel - 1];
        aspeed_kcs_set_address(kcs, slave);
 
-       return 0;
+       return kcs;
 }
 
 static int aspeed_kcs_calculate_channel(const struct kcs_ioreg *regs)
--

2.25.1

Acked-by on v1 1/1
#3 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Joel Stanley
Quoted 4 lines · Dan Carpenter

This needs to return the newly allocated struct but instead it returns zero which leads to an immediate Oops in the caller.

Quoted 7 lines
Quoted 2 lines
Fixes 09f5f680707e ("ipmi: kcs: aspeed: Implement v2 bindings")

Thanks for the fix Dan.

Andrew, I think this means no one has used the v1 bindings in mainline, so could remove that code?

No, rather Dan's on the ball and it seems I was a bit lax with my testing of the patch. I pinged Corey only the other day regarding the patches; he had been busy and as such hadn't merged them.

I have a series to convert our devicetrees over to v2. Now that Corey's taken the patches I can send that and we can get away from v1.

Thanks for the fix Dan.