From: Sumitra Sharma <sumitraartsy@gmail.com>
To: outreachy@lists.linux.dev
Subject: Warn on macros with flow control statements
Date: Thu, 16 Mar 2023 01:08:34 -0700 [thread overview]
Message-ID: <20230316080834.GA43491@sumitra.com> (raw)
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
next reply other threads:[~2023-03-16 8:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 8:08 Sumitra Sharma [this message]
2023-03-16 8:26 ` Warn on macros with flow control statements 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230316080834.GA43491@sumitra.com \
--to=sumitraartsy@gmail.com \
--cc=outreachy@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.