All of lore.kernel.org
 help / color / mirror / Atom feed
* Warn on macros with flow control statements
@ 2023-03-16  8:08 Sumitra Sharma
  2023-03-16  8:26 ` Julia Lawall
  2023-03-18  5:33 ` Ira Weiny
  0 siblings, 2 replies; 10+ messages in thread
From: Sumitra Sharma @ 2023-03-16  8:08 UTC (permalink / raw)
  To: outreachy


Hi

I am working on the below chechpatch.pl check

WARNING: Macros with flow control statements should be avoided
#42: FILE: ./drivers/staging/qlge/qlge_devlink.c:42:
+#define FILL_SEG(seg_hdr, seg_regs)                                        \
+       do {                                                                \
+               err = qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \
+               if (err) {                                                  \
+                       kvfree(dump);                                       \
+                       return err;                                         \
+               }                                                           \
+       } while (0)


I was trying to change this macro into an inline function like this

static inline int FILL_SEG(struct devlink_fmsg *fmsg, struct mpi_coredump_segment_header *seg_hdr, u32 *seg_regs)
{
        int err =0;

        err = qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs);
        if (err) {
                kvfree(dump);
                return err;
        }
}

But I am not sure whether I am going in the right direction..or how to
move further in it. I am looking for some guidance.



Regards,

Sumitra

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-03-23 16:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16  8:08 Warn on macros with flow control statements Sumitra Sharma
2023-03-16  8:26 ` Julia Lawall
2023-03-17  7:23   ` Sumitra Sharma
2023-03-18  5:33 ` Ira Weiny
2023-03-18  6:05   ` Julia Lawall
2023-03-18  6:19     ` Ira Weiny
2023-03-23  6:28       ` Sumitra Sharma
2023-03-23  8:15         ` Julia Lawall
2023-03-23 16:25           ` Ira Weiny
2023-03-23 16:19         ` Ira Weiny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.