Le 11/02/2023 à 14:43, Harshit Mogalapalli a écrit :
Also tracking these type of goto are uninteresting for the check.
fail:
ata_dev_err(dev, "failed to set xfermode (err_mask=0x%x)\n", err_mask);
return -EIO;
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
---
check_direct_return_instead_of_goto.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/check_direct_return_instead_of_goto.c b/check_direct_return_instead_of_goto.c
index b075bc2f..90e5aed6 100644
--- a/check_direct_return_instead_of_goto.c
+++ b/check_direct_return_instead_of_goto.c
@@ -68,6 +68,7 @@ static bool is_do_nothing_goto(struct statement *goto_stmt)
static bool is_printk_stmt(struct statement *stmt)
{
char *str;
+ int len;
if (!stmt)
return false;
@@ -76,6 +77,8 @@ static bool is_printk_stmt(struct statement *stmt)
if (!str)
return false;
+ len = strlen(str);
+
if (strcmp(str, "dev_err") == 0 ||
strcmp(str, "dev_info") == 0 ||
strcmp(str, "dev_warn") == 0 ||
@@ -92,6 +95,11 @@ static bool is_printk_stmt(struct statement *stmt)
strcmp(str, "pr_debug") == 0)
return true;
+ if (strcmp(&str[len - 8], "_dev_err") == 0 ||
+ strcmp(&str[len - 9], "_dev_warn") == 0 ||
+ strcmp(&str[len - 8], "_dev_dbg") == 0)
Hi,
When we get here, can len be <8 or <9 ?
CJ
+ return true;
+
return false;
}