From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH] sr: Fix a recently introduced W=1 compiler warning
Date: Sun, 29 Mar 2020 19:53:04 -0700 [thread overview]
Message-ID: <20200330025304.10743-1-bvanassche@acm.org> (raw)
Fix the following compiler warning:
drivers/scsi/sr.c:686:12: warning: initialized field overwritten [-Woverride-init]
686 | .ioctl = sr_block_compat_ioctl,
| ^~~~~~~~~~~~~~~~~~~~~
drivers/scsi/sr.c:686:12: note: (near initialization for 'sr_bdops.ioctl')
Cc: Arnd Bergmann <arnd@arndb.de>
Fixes: d320a9551e39 ("compat_ioctl: scsi: move ioctl handling into drivers")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/sr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index fe0e1c721a99..9ad57a98a37f 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -556,6 +556,7 @@ static void sr_block_release(struct gendisk *disk, fmode_t mode)
mutex_unlock(&cd->lock);
}
+#ifndef CONFIG_COMPAT
static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
unsigned long arg)
{
@@ -597,8 +598,7 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
mutex_unlock(&cd->lock);
return ret;
}
-
-#ifdef CONFIG_COMPAT
+#else /* !defined(CONFIG_COMPAT) */
static int sr_block_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
unsigned long arg)
{
@@ -641,7 +641,7 @@ static int sr_block_compat_ioctl(struct block_device *bdev, fmode_t mode, unsign
return ret;
}
-#endif
+#endif /* !defined(CONFIG_COMPAT) */
static unsigned int sr_block_check_events(struct gendisk *disk,
unsigned int clearing)
@@ -685,8 +685,9 @@ static const struct block_device_operations sr_bdops =
.owner = THIS_MODULE,
.open = sr_block_open,
.release = sr_block_release,
+#ifndef CONFIG_COMPAT
.ioctl = sr_block_ioctl,
-#ifdef CONFIG_COMPAT
+#else
.ioctl = sr_block_compat_ioctl,
#endif
.check_events = sr_block_check_events,
next reply other threads:[~2020-03-30 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 2:53 Bart Van Assche [this message]
2020-03-30 3:06 ` [PATCH] sr: Fix a recently introduced W=1 compiler warning James Bottomley
2020-03-30 8:59 ` Arnd Bergmann
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=20200330025304.10743-1-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=arnd@arndb.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox