summaryrefslogtreecommitdiffstats
path: root/src/udev/scsi_id
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2022-08-30 09:28:56 +0200
committerJan Janssen <medhefgo@web.de>2022-08-30 12:03:33 +0200
commit5570a09702b2a4c77772617d5fce97b6b70ec03f (patch)
tree6894fe53f7ed84cce0f20d1190648e0797ca8023 /src/udev/scsi_id
parenttree-wide: Fix a some remaining format warnings by casting (diff)
downloadsystemd-5570a09702b2a4c77772617d5fce97b6b70ec03f.tar.xz
systemd-5570a09702b2a4c77772617d5fce97b6b70ec03f.zip
tree-wide: Fix format specifier warnings for %x
Unfortunately, hex output can only be produced with unsigned types. Some cases can be fixed by producing the correct type, but a few simply have to be cast. At least casting makes it explicit.
Diffstat (limited to 'src/udev/scsi_id')
-rw-r--r--src/udev/scsi_id/scsi_id.c2
-rw-r--r--src/udev/scsi_id/scsi_serial.c9
2 files changed, 4 insertions, 7 deletions
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 8ce73d03da..364d567705 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -357,7 +357,7 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int *
break;
default:
- log_error("Unknown or bad option '%c' (0x%x)", option, option);
+ log_error("Unknown or bad option '%c' (0x%x)", option, (unsigned) option);
retval = -1;
break;
}
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 299ccb96fb..47c2a5cb4f 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -154,10 +154,7 @@ static int sg_err_category4(struct sg_io_v4 *hp) {
static int scsi_dump_sense(struct scsi_id_device *dev_scsi,
unsigned char *sense_buffer, int sb_len) {
int s;
- int code;
- int sense_class;
- int sense_key;
- int asc, ascq;
+ unsigned code, sense_class, sense_key, asc, ascq;
/*
* Figure out and print the sense key, asc and ascq.
@@ -221,11 +218,11 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi,
4 - sb_len);
if (sense_buffer[0] < 15)
- log_debug("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0f);
+ log_debug("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0fu);
else
log_debug("%s: sense = %2x %2x",
dev_scsi->kernel, sense_buffer[0], sense_buffer[2]);
- log_debug("%s: non-extended sense class %d code 0x%0x",
+ log_debug("%s: non-extended sense class %u code 0x%0x",
dev_scsi->kernel, sense_class, code);
}