diff mbox series

EDAC/altera: Fix error checking

Message ID 20230517191556.367689-1-asuk4.q@gmail.com (mailing list archive)
State New, archived
Headers show
Series EDAC/altera: Fix error checking | expand

Commit Message

Yeqi Fu May 17, 2023, 7:15 p.m. UTC
The function edac_debugfs_create_dir returns ERR_PTR if an error
occurs, and the appropriate way to verify for errors is to use the
inline function IS_ERR. The patch will substitute the null-comparison
with IS_ERR.

Signed-off-by: Yeqi Fu <asuk4.q@gmail.com>
---
 drivers/edac/altera_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Borislav Petkov June 7, 2023, 8:51 a.m. UTC | #1
On Thu, May 18, 2023 at 03:15:56AM +0800, Yeqi Fu wrote:
> The function edac_debugfs_create_dir returns ERR_PTR if an error
> occurs, and the appropriate way to verify for errors is to use the
> inline function IS_ERR. The patch will substitute the null-comparison
> with IS_ERR.
> 
> Signed-off-by: Yeqi Fu <asuk4.q@gmail.com>
> ---
>  drivers/edac/altera_edac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index 8b31cd54bdb6..19693333408f 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -683,7 +683,7 @@ static void altr_create_edacdev_dbgfs(struct edac_device_ctl_info *edac_dci,
>  		return;
>  
>  	drvdata->debugfs_dir = edac_debugfs_create_dir(drvdata->edac_dev_name);
> -	if (!drvdata->debugfs_dir)
> +	if (IS_ERR(drvdata->debugfs_dir))
>  		return;
>  
>  	if (!edac_debugfs_create_file("altr_trigger", S_IWUSR,
> -- 

Applied, thanks.
diff mbox series

Patch

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 8b31cd54bdb6..19693333408f 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -683,7 +683,7 @@  static void altr_create_edacdev_dbgfs(struct edac_device_ctl_info *edac_dci,
 		return;
 
 	drvdata->debugfs_dir = edac_debugfs_create_dir(drvdata->edac_dev_name);
-	if (!drvdata->debugfs_dir)
+	if (IS_ERR(drvdata->debugfs_dir))
 		return;
 
 	if (!edac_debugfs_create_file("altr_trigger", S_IWUSR,