Powered by Linux
[PATCH] direct_return_instead_of_goto: don't warn about other forms of printks — Semantic Matching Tool

[PATCH] direct_return_instead_of_goto: don't warn about other forms of printks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
+		return true;
+
 	return false;
 }
 
-- 
2.38.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux