stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] memory: renesas-rpc-if: Return correct value to the caller of rpcif_manual_xfer()
       [not found] <20201124112552.26377-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
@ 2020-11-24 11:25 ` Lad Prabhakar
  2020-11-25  8:48   ` Sergei Shtylyov
  2020-11-24 11:25 ` [PATCH 5/5] memory: renesas-rpc-if: Fix a reference leak in rpcif_probe() Lad Prabhakar
  1 sibling, 1 reply; 4+ messages in thread
From: Lad Prabhakar @ 2020-11-24 11:25 UTC (permalink / raw)
  To: Sergei Shtylyov, Krzysztof Kozlowski, Philipp Zabel, Jiri Kosina,
	Mark Brown
  Cc: linux-kernel, linux-renesas-soc, Biju Das, Prabhakar,
	Lad Prabhakar, stable

In the error path of rpcif_manual_xfer() the value of ret is overwritten
by value returned by reset_control_reset() function and thus returning
incorrect value to the caller.

This patch makes sure the correct value is returned to the caller of
rpcif_manual_xfer() by dropping the overwrite of ret in error path.
Also now we ignore the value returned by reset_control_reset() in the
error path and instead print a error message when it fails.

Fixes: ca7d8b980b67f ("memory: add Renesas RPC-IF driver")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: stable@vger.kernel.org
---
 drivers/memory/renesas-rpc-if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index f2a33a1af836..69f2e2b4cd50 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -508,7 +508,8 @@ int rpcif_manual_xfer(struct rpcif *rpc)
 	return ret;
 
 err_out:
-	ret = reset_control_reset(rpc->rstc);
+	if (reset_control_reset(rpc->rstc))
+		dev_err(rpc->dev, "Failed to reset HW\n");
 	rpcif_hw_init(rpc, rpc->bus_size == 2);
 	goto exit;
 }
-- 
2.17.1


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

* [PATCH 5/5] memory: renesas-rpc-if: Fix a reference leak in rpcif_probe()
       [not found] <20201124112552.26377-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
  2020-11-24 11:25 ` [PATCH 1/5] memory: renesas-rpc-if: Return correct value to the caller of rpcif_manual_xfer() Lad Prabhakar
@ 2020-11-24 11:25 ` Lad Prabhakar
  2020-11-25 12:10   ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Lad Prabhakar @ 2020-11-24 11:25 UTC (permalink / raw)
  To: Sergei Shtylyov, Krzysztof Kozlowski, Philipp Zabel, Jiri Kosina,
	Mark Brown
  Cc: linux-kernel, linux-renesas-soc, Biju Das, Prabhakar,
	Lad Prabhakar, stable

Release the node reference by calling of_node_put(flash) in the probe.

Fixes: ca7d8b980b67f ("memory: add Renesas RPC-IF driver")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: stable@vger.kernel.org
---
 drivers/memory/renesas-rpc-if.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index f5cbc762fda7..99633986ffda 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -548,9 +548,11 @@ static int rpcif_probe(struct platform_device *pdev)
 	} else if (of_device_is_compatible(flash, "cfi-flash")) {
 		name = "rpc-if-hyperflash";
 	} else	{
+		of_node_put(flash);
 		dev_warn(&pdev->dev, "unknown flash type\n");
 		return -ENODEV;
 	}
+	of_node_put(flash);
 
 	vdev = platform_device_alloc(name, pdev->id);
 	if (!vdev)
-- 
2.17.1


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

* Re: [PATCH 1/5] memory: renesas-rpc-if: Return correct value to the caller of rpcif_manual_xfer()
  2020-11-24 11:25 ` [PATCH 1/5] memory: renesas-rpc-if: Return correct value to the caller of rpcif_manual_xfer() Lad Prabhakar
@ 2020-11-25  8:48   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2020-11-25  8:48 UTC (permalink / raw)
  To: Lad Prabhakar, Sergei Shtylyov, Krzysztof Kozlowski,
	Philipp Zabel, Jiri Kosina, Mark Brown
  Cc: linux-kernel, linux-renesas-soc, Biju Das, Prabhakar, stable

Hello!

On 24.11.2020 14:25, Lad Prabhakar wrote:

> In the error path of rpcif_manual_xfer() the value of ret is overwritten
> by value returned by reset_control_reset() function and thus returning
> incorrect value to the caller.
> 
> This patch makes sure the correct value is returned to the caller of
> rpcif_manual_xfer() by dropping the overwrite of ret in error path.
> Also now we ignore the value returned by reset_control_reset() in the
> error path and instead print a error message when it fails.
> 
> Fixes: ca7d8b980b67f ("memory: add Renesas RPC-IF driver")
> Reported-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: stable@vger.kernel.org

Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>

MBR, Sergei

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

* Re: [PATCH 5/5] memory: renesas-rpc-if: Fix a reference leak in rpcif_probe()
  2020-11-24 11:25 ` [PATCH 5/5] memory: renesas-rpc-if: Fix a reference leak in rpcif_probe() Lad Prabhakar
@ 2020-11-25 12:10   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2020-11-25 12:10 UTC (permalink / raw)
  To: Lad Prabhakar, Sergei Shtylyov, Krzysztof Kozlowski,
	Philipp Zabel, Jiri Kosina, Mark Brown
  Cc: linux-kernel, linux-renesas-soc, Biju Das, Prabhakar, stable

On 11/24/20 2:25 PM, Lad Prabhakar wrote:

> Release the node reference by calling of_node_put(flash) in the probe.

   Sorry about missing this...

> Fixes: ca7d8b980b67f ("memory: add Renesas RPC-IF driver")
> Reported-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: stable@vger.kernel.org

Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>

[...]

MBR, Sergei

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

end of thread, other threads:[~2020-11-25 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201124112552.26377-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
2020-11-24 11:25 ` [PATCH 1/5] memory: renesas-rpc-if: Return correct value to the caller of rpcif_manual_xfer() Lad Prabhakar
2020-11-25  8:48   ` Sergei Shtylyov
2020-11-24 11:25 ` [PATCH 5/5] memory: renesas-rpc-if: Fix a reference leak in rpcif_probe() Lad Prabhakar
2020-11-25 12:10   ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).