Skip to contentSkip to conversation

ide-cd: signedness warning fix again

PATCH Applied Connor Hansen 2 participants 2 messages Jun 2, 2011 – Jun 11, 2011 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ide-cd: signedness warning fix again

One of the legit warnings 'make W=3 drivers/ide/ide-cd.c' generates is:
drivers/ide/ide-cd.c: In function ide_cd_do_request drivers/ide/ide-cd.c:828:2: warning: conversion to int from \
unsigned int may change the sign of the result drivers/ide/ide-cd.c:833:2: warning: conversion to int from \
unsigned int may change the sign of the result

nsectors is declared int, should be unsigned int.

blk_rq-sectors() returns unsigned int, and ide_complete_rq expects unsigned int as well. Fixes both warnings.

---
 drivers/ide/ide-cd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/ide/ide-cd.c +2 -1
index 5d17ab4..0a61f63 100644
@@ -778,7 +778,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
 					sector_t block)
 {
 	struct ide_cmd cmd;
-	int uptodate = 0, nsectors;
+	int uptodate = 0;
+	unsigned int nsectors;
 
 	ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu",
 				  rq->cmd[0], (unsigned long long)block);
Signature · 1 line
1.7.4.4
Applied
#1 lore raw

From: Connor Hansen <[email protected]>
Date: Wed, 1 Jun 2011 22:52:05 -0700

Quoted 8 lines

One of the legit warnings 'make W=3 drivers/ide/ide-cd.c' generates is:
drivers/ide/ide-cd.c: In function ide_cd_do_request drivers/ide/ide-cd.c:828:2: warning: conversion to int from \
unsigned int may change the sign of the result drivers/ide/ide-cd.c:833:2: warning: conversion to int from \
unsigned int may change the sign of the result

Quoted 6 lines

nsectors is declared int, should be unsigned int.

blk_rq-sectors() returns unsigned int, and ide_complete_rq expects unsigned int as well. Fixes both warnings.

Applied, thanks.