Skip to content

Commit

Permalink
linux-iot2050: Add two fixes for icssg-prueth
Browse files Browse the repository at this point in the history
Minor ones, just affecting the error paths, but who knows.

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka authored and BaochengSu committed Nov 14, 2023
1 parent 96acfeb commit e15fe5a
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jan Kiszka <[email protected]>
Date: Thu, 2 Nov 2023 16:54:32 +0100
Subject: [PATCH] net: ti: icssg-prueth: Add missing icss_iep_put to error path

Analogously to prueth_remove, just also taking care for NULL'ing the
iep pointers.

Fixes: 186734c15886 ("net: ti: icssg-prueth: add packet timestamping and ptp support")
Fixes: 443a2367ba3c ("net: ti: icssg-prueth: am65x SR2.0 add 10M full duplex support")
Signed-off-by: Jan Kiszka <[email protected]>
---
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 3557749322df..fb445823b434 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -2112,10 +2112,7 @@ static int prueth_probe(struct platform_device *pdev)
prueth->iep1 = icss_iep_get_idx(np, 1);
if (IS_ERR(prueth->iep1)) {
ret = dev_err_probe(dev, PTR_ERR(prueth->iep1), "iep1 get failed\n");
- icss_iep_put(prueth->iep0);
- prueth->iep0 = NULL;
- prueth->iep1 = NULL;
- goto free_pool;
+ goto put_iep0;
}

if (prueth->pdata.quirk_10m_link_issue) {
@@ -2212,6 +2209,12 @@ static int prueth_probe(struct platform_device *pdev)
exit_iep:
if (prueth->pdata.quirk_10m_link_issue)
icss_iep_exit_fw(prueth->iep1);
+ icss_iep_put(prueth->iep1);
+
+put_iep0:
+ icss_iep_put(prueth->iep0);
+ prueth->iep0 = NULL;
+ prueth->iep1 = NULL;

free_pool:
gen_pool_free(prueth->sram_pool,
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jan Kiszka <[email protected]>
Date: Fri, 3 Nov 2023 10:09:50 +0100
Subject: [PATCH] net: ti: icssg-prueth: Fix error cleanup on failing
pruss_request_mem_region

We were just continuing in this case, surely not desired.

Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Signed-off-by: Jan Kiszka <[email protected]>
[Taken from https://lore.kernel.org/lkml/[email protected]/]
---
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index fb445823b434..2b22e98dd677 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -2070,7 +2070,7 @@ static int prueth_probe(struct platform_device *pdev)
&prueth->shram);
if (ret) {
dev_err(dev, "unable to get PRUSS SHRD RAM2: %d\n", ret);
- pruss_put(prueth->pruss);
+ goto put_pruss;
}

prueth->sram_pool = of_gen_pool_get(np, "sram", 0);
@@ -2222,6 +2222,8 @@ static int prueth_probe(struct platform_device *pdev)

put_mem:
pruss_release_mem_region(prueth->pruss, &prueth->shram);
+
+put_pruss:
pruss_put(prueth->pruss);

put_cores:

0 comments on commit e15fe5a

Please sign in to comment.