From: Dan Carpenter <dan.carpenter@oracle.com>
To: mirq-linux@rere.qmqm.pl
Cc: linux-mmc@vger.kernel.org
Subject: re: mmc: Driver for CB710/720 memory card reader (MMC part)
Date: Wed, 12 Aug 2015 14:00:51 +0300 [thread overview]
Message-ID: <20150812110051.GC22571@mwanda> (raw)
Hello Michał Mirosław,
The patch 5f5bac8272be: "mmc: Driver for CB710/720 memory card reader
(MMC part)" from May 22, 2009, leads to the following static checker
warning:
drivers/mmc/host/cb710-mmc.c:579 cb710_mmc_set_ios()
warn: 'err' can be either negative or positive
drivers/mmc/host/cb710-mmc.c
112
113 static int cb710_check_event(struct cb710_slot *slot, u8 what)
114 {
115 u16 status;
116
117 status = cb710_read_port_16(slot, CB710_MMC_STATUS_PORT);
118
119 if (status & CB710_MMC_S0_FIFO_UNDERFLOW) {
120 /* it is just a guess, so log it */
121 dev_dbg(cb710_slot_dev(slot),
122 "CHECK : ignoring bit 6 in status %04X\n", status);
123 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT,
124 CB710_MMC_S0_FIFO_UNDERFLOW);
125 status &= ~CB710_MMC_S0_FIFO_UNDERFLOW;
126 }
127
128 if (status & CB710_MMC_STATUS_ERROR_EVENTS) {
129 dev_dbg(cb710_slot_dev(slot),
130 "CHECK : returning EIO on status %04X\n", status);
131 cb710_write_port_8(slot, CB710_MMC_STATUS0_PORT, status & 0xFF);
132 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT,
133 CB710_MMC_S1_RESET);
134 return -EIO;
135 }
136
137 /* 'what' is a bit in MMC_STATUS1 */
138 if ((status >> 8) & what) {
139 cb710_write_port_8(slot, CB710_MMC_STATUS1_PORT, what);
140 return 1;
There are two callers to this function. It appears to me that one
expects zero on error and one expects non-zero on error. It is
confusing and there are no comments explaining the return codes.
141 }
142
143 return 0;
144 }
regards,
dan carpenter
next reply other threads:[~2015-08-12 11:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 11:00 Dan Carpenter [this message]
2015-08-18 18:05 ` mmc: Driver for CB710/720 memory card reader (MMC part) Michał Mirosław
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=20150812110051.GC22571@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-mmc@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
/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.