[PATCH] memory: emif: Add check for setup_interrupts

Jiasheng Jiang posted 1 patch 4 years, 3 months ago
drivers/memory/emif.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] memory: emif: Add check for setup_interrupts
Posted by Jiasheng Jiang 4 years, 3 months ago
As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value of the
setup_interrupts() and return error if fails.

Fixes: 68b4aee35d1f ("memory: emif: add interrupt and temperature handling")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/memory/emif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 762d0c0f0716..d4d4044e05b3 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -1117,7 +1117,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
 {
 	struct emif_data	*emif;
 	struct resource		*res;
-	int			irq;
+	int			irq, ret;
 
 	if (pdev->dev.of_node)
 		emif = of_get_memory_device_details(pdev->dev.of_node, &pdev->dev);
@@ -1147,7 +1147,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
 	emif_onetime_settings(emif);
 	emif_debugfs_init(emif);
 	disable_and_clear_all_interrupts(emif);
-	setup_interrupts(emif, irq);
+	ret = setup_interrupts(emif, irq);
+	if (ret)
+		goto error;
 
 	/* One-time actions taken on probing the first device */
 	if (!emif1) {
-- 
2.25.1

Re: [PATCH] memory: emif: Add check for setup_interrupts
Posted by Krzysztof Kozlowski 4 years, 3 months ago
On Thu, 24 Feb 2022 10:54:44 +0800, Jiasheng Jiang wrote:
> As the potential failure of the devm_request_threaded_irq(),
> it should be better to check the return value of the
> setup_interrupts() and return error if fails.
> 
> 

Applied, thanks!

[1/1] memory: emif: Add check for setup_interrupts
      commit: fd7bd80b46373887b390852f490f21b07e209498

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>