From: Tao Ma <tm@tao.ma>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd.
Date: Tue, 22 Mar 2011 12:04:08 +0800 [thread overview]
Message-ID: <1300766648-18095-1-git-send-email-tm@tao.ma> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]
From: Tao Ma <boyu.mt@taobao.com>
This patch is inspired by a build waring.
drivers/scsi/sd.c:544: warning: ‘ret’ may be used uninitialized in this function
So we need to set a default value to ret here.
But a deep look at scsi_setup_discard_cmnd makes me think
of which value should be set. Now we have BLKPREP_KILL and
BLKPREP_DEFER to indicate an error. As in case of an
unknown sdkp->provisioning_mode, we goto out directly. So
I guess we should return BLKPREP_KILL here and free the page.
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
drivers/scsi/sd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3be5db5..91564bd 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -541,7 +541,7 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
sector_t sector = bio->bi_sector;
unsigned int nr_sectors = bio_sectors(bio);
unsigned int len;
- int ret;
+ int ret = BLKPREP_KILL;
char *buf;
struct page *page;
--
1.6.3.GIT
next reply other threads:[~2011-03-22 4:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-22 4:04 Tao Ma [this message]
2011-03-22 12:57 ` Jeff Moyer
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=1300766648-18095-1-git-send-email-tm@tao.ma \
--to=tm@tao.ma \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®