From: Dan Carpenter <dan.carpenter@oracle.com>
To: aaron.lu@intel.com
Cc: linux-ide@vger.kernel.org
Subject: re: libata: check zero power ready status for ZPODD
Date: Thu, 14 Apr 2016 12:30:22 +0300 [thread overview]
Message-ID: <20160414093022.GA16431@mwanda> (raw)
Hello Aaron Lu,
The patch 3dc67440d99b: "libata: check zero power ready status for
ZPODD" from Jan 15, 2013, leads to the following static checker
warning:
drivers/ata/libata-zpodd.c:97 zpready()
error: uninitialized symbol 'sense_key'.
drivers/ata/libata-zpodd.c
88 /* Test if ODD is zero power ready by sense code */
89 static bool zpready(struct ata_device *dev)
90 {
91 u8 sense_key, *sense_buf;
92 unsigned int ret, asc, ascq, add_len;
93 struct zpodd *zpodd = dev->zpodd;
94
95 ret = atapi_eh_tur(dev, &sense_key);
96
97 if (!ret || sense_key != NOT_READY)
98 return false;
It's not clear what is going on here. atapi_eh_tur() returns 0 on
success or a bit mask on error. If the AC_ERR_DEV (which is BIT(0)) bit
is set and no other bits then we set "&sense_key" otherwise it is
uninitialized.
So maybe the test should be:
if (ret != AC_ERR_DEV || sense_key != NOT_READY)
return false;
That would silence the uninitialized variable warning but it's sort of
weird. You would normall expect to return for errors and continue if
ret were zero.
if (ret && !(ret == AC_ERR_DEV && ...
99
100 sense_buf = dev->link->ap->sector_buf;
101 ret = atapi_eh_request_sense(dev, sense_buf, sense_key);
102 if (ret)
103 return false;
regards,
dan carpenter
next reply other threads:[~2016-04-14 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 9:30 Dan Carpenter [this message]
2016-04-15 2:34 ` libata: check zero power ready status for ZPODD Aaron Lu
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=20160414093022.GA16431@mwanda \
--to=dan.carpenter@oracle.com \
--cc=aaron.lu@intel.com \
--cc=linux-ide@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 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.