diff mbox series

[1/1] pci: add return value check to devm_add_action_or_reset

Message ID 20230716124835.5909-1-ruc_gongyuanjun@163.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [1/1] pci: add return value check to devm_add_action_or_reset | expand

Checks

Context Check Description
conchuod/cover_letter success Single patches do not need cover letters
conchuod/tree_selection success Guessed tree name to be for-next at HEAD 471aba2e4760
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 4 and now 4
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 10 this patch: 10
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 9 this patch: 9
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 3 this patch: 3
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch warning CHECK: Alignment should match open parenthesis
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Yuanjun Gong July 16, 2023, 12:48 p.m. UTC
devm_add_action_or_reset() may fail, therefore, a check to the
return value of devm_add_action_or_reset() is added before return.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/pci/controller/pcie-microchip-host.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Conor Dooley July 17, 2023, 9:37 a.m. UTC | #1
Hey,

> $subject: pci: add return value check to devm_add_action_or_reset

Typically patches for this driver have used the prefix "PCI:
microchip:". Also, please put the () at the end of functions in commit
messages.

On Sun, Jul 16, 2023 at 08:48:35PM +0800, Yuanjun Gong wrote:
> devm_add_action_or_reset() may fail, therefore, a check to the
> return value of devm_add_action_or_reset() is added before return.
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
>  drivers/pci/controller/pcie-microchip-host.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
> index 5e710e485464..8c77284fdc84 100644
> --- a/drivers/pci/controller/pcie-microchip-host.c
> +++ b/drivers/pci/controller/pcie-microchip-host.c
> @@ -863,8 +863,10 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> -	devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
> +	ret = devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
>  				 clk);

Did checkpatch not complain about the alignment here?

With those fixed,
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

> +	if (ret)
> +		return ERR_PTR(ret);
>  
>  	return clk;
>  }
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c
index 5e710e485464..8c77284fdc84 100644
--- a/drivers/pci/controller/pcie-microchip-host.c
+++ b/drivers/pci/controller/pcie-microchip-host.c
@@ -863,8 +863,10 @@  static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id)
 	if (ret)
 		return ERR_PTR(ret);
 
-	devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
+	ret = devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare,
 				 clk);
+	if (ret)
+		return ERR_PTR(ret);
 
 	return clk;
 }