From: Roel Kluin <roel.kluin@gmail.com>
To: mail@davidkiliani.de, g.gebhardt@meilhaus.de, Greg KH <gregkh@suse.de>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] staging: unsigned won't get negative after subtraction
Date: Sun, 18 Jan 2009 15:34:55 +0100 [thread overview]
Message-ID: <49733E0F.7030305@gmail.com> (raw)
This also contains a fix I sent earlier, I'm not sure how split this patch,
but this is about the second hunk.
vi drivers/staging/meilhaus/me6000_ao.h +112
typedef struct me6000_ao_subdevice {
...
unsigned int ao_idx;
...
};
Since unsigned, it won't get negative after subtraction.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/staging/meilhaus/me6000_ao.c b/drivers/staging/meilhaus/me6000_ao.c
index 94f0123..dcb3526 100644
--- a/drivers/staging/meilhaus/me6000_ao.c
+++ b/drivers/staging/meilhaus/me6000_ao.c
@@ -1063,7 +1063,7 @@ static int me6000_ao_io_stream_config(me_subdevice_t * subdevice,
}
if (flags & ME_IO_STREAM_CONFIG_HARDWARE_ONLY) {
- if (!flags & ME_IO_STREAM_CONFIG_WRAPAROUND) {
+ if (!(flags & ME_IO_STREAM_CONFIG_WRAPAROUND)) {
PERROR
("Hardware ME_IO_STREAM_CONFIG_HARDWARE_ONLY has to be with ME_IO_STREAM_CONFIG_WRAPAROUND.\n");
return ME_ERRNO_INVALID_FLAGS;
@@ -2825,10 +2825,11 @@ int inline ao_stop_immediately(me6000_ao_subdevice_t * instance)
int i;
uint32_t single_mask;
- single_mask =
- (instance->ao_idx - ME6000_AO_SINGLE_STATUS_OFFSET <
- 0) ? 0x0000 : (0x0001 << (instance->ao_idx -
- ME6000_AO_SINGLE_STATUS_OFFSET));
+ if (instance->ao_idx < ME6000_AO_SINGLE_STATUS_OFFSET)
+ single_mask = 0x0000;
+ else
+ single_mask = 0x0001 << (instance->ao_idx -
+ ME6000_AO_SINGLE_STATUS_OFFSET);
timeout =
(instance->hardware_stop_delay >
next reply other threads:[~2009-01-18 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-18 14:34 Roel Kluin [this message]
2009-01-21 18:07 ` patch staging-meilhaus-unsigned-won-t-get-negative-after-subtraction.patch added to gregkh-2.6 tree gregkh
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=49733E0F.7030305@gmail.com \
--to=roel.kluin@gmail.com \
--cc=g.gebhardt@meilhaus.de \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@davidkiliani.de \
/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.