All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avri Altman <avri.altman@wdc.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, linux-mmc@vger.kernel.org
Cc: Avri Altman <avri.altman@wdc.com>
Subject: [PATCH] mmc-utils: Assert MMC_IOC_MULTI_CMD in compile time
Date: Wed, 24 May 2023 11:42:24 +0300	[thread overview]
Message-ID: <20230524084224.558-1-avri.altman@wdc.com> (raw)

Notify of mult-ioctl violation during preprocessing instead of bailing
out in runtime.  Would not even allow bogus copies of mmc-utils binaries
wondering about out there.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
 mmc_cmds.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mmc_cmds.c b/mmc_cmds.c
index df66986..a4819ab 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -2113,9 +2113,7 @@ static int do_rpmb_op(int fd,
 					  unsigned int out_cnt)
 {
 #ifndef MMC_IOC_MULTI_CMD
-	fprintf(stderr, "mmc-utils has been compiled without MMC_IOC_MULTI_CMD"
-		" support, needed by RPMB operation.\n");
-	exit(1);
+#error "mmc-utils needs MMC_IOC_MULTI_CMD support"
 #else
 	int err;
 	u_int16_t rpmb_type;
@@ -2805,9 +2803,7 @@ out:
 int do_ffu(int nargs, char **argv)
 {
 #ifndef MMC_IOC_MULTI_CMD
-	fprintf(stderr, "mmc-utils has been compiled without MMC_IOC_MULTI_CMD"
-			" support, needed by FFU.\n");
-	exit(1);
+#error "mmc-utils needs MMC_IOC_MULTI_CMD support"
 #else
 	int dev_fd, img_fd;
 	int sect_done = 0, retry = 3, ret = -EINVAL;
-- 
2.40.0


             reply	other threads:[~2023-05-24  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  8:42 Avri Altman [this message]
2023-06-08 21:44 ` [PATCH] mmc-utils: Assert MMC_IOC_MULTI_CMD in compile time Ulf Hansson
2023-06-09  8:24   ` Avri Altman

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=20230524084224.558-1-avri.altman@wdc.com \
    --to=avri.altman@wdc.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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.