Skip to contentSkip to conversation

hexagon: fix warning comparing pointer to 0

PATCH Atul Raut 2 participants 2 messages Aug 9, 2023 Qualcomm hexagon architecture

lore
Share & tools
lore

Atul Raut

author
#0 lore raw

Fix the following coccicheck warning:
./arch/hexagon/kernel/traps.c:138:6-7: WARNING comparing pointer to 0

---
 arch/hexagon/kernel/traps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/hexagon/kernel/traps.c +2 -2
index 6447763ce5a9..78486eea77d7 100644
@@ -80,7 +80,7 @@ static void do_show_stack(struct task_struct *task, unsigned long *fp,
 	int kstack_depth_to_print = 24;
 	unsigned long offset, size;
 	const char *name = NULL;
-	unsigned long *newfp;
+	unsigned long *newfp = NULL;
 	unsigned long low, high;
 	char tmpstr[128];
 	char *modname;
@@ -135,7 +135,7 @@ static void do_show_stack(struct task_struct *task, unsigned long *fp,
 		}
 
 		/* Attempt to continue past exception. */
-		if (0 == newfp) {
+		if (!newfp) {
 			struct pt_regs *regs = (struct pt_regs *) (((void *)fp)
 						+ 8);
 
Signature · 1 line
2.34.1
Acked-by
#1 lore raw
Quoted 46 lines

-----Original Message-----
From: Atul Raut <[email protected]>
Sent: Wednesday, August 9, 2023 1:52 PM
To: Brian Cain <[email protected]>
Cc: [email protected]; linux-kernel- [email protected]
Subject: hexagon: fix warning comparing pointer to 0

WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.

Fix the following coccicheck warning:
./arch/hexagon/kernel/traps.c:138:6-7: WARNING comparing pointer to 0

---
 arch/hexagon/kernel/traps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/hexagon/kernel/traps.c +1 -1
index 6447763ce5a9..78486eea77d7 100644
@@ -80,7 +80,7 @@ static void do_show_stack(struct task_struct *task,
 unsigned long *fp,
        int kstack_depth_to_print = 24;
        unsigned long offset, size;
        const char *name = NULL;
-       unsigned long *newfp;
+       unsigned long *newfp = NULL;
        unsigned long low, high;
        char tmpstr[128];
        char *modname;
arch/hexagon/kernel/traps.c +1 -2
@@ -135,7 +135,7 @@ static void do_show_stack(struct task_struct *task,
 unsigned long *fp,
                }
 
                /* Attempt to continue past exception. */
-               if (0 == newfp) {
+               if (!newfp) {
                        struct pt_regs *regs = (struct pt_regs *) (((void *)fp)
                                                + 8);
 
--
Quoted 1 line

2.34.1