[PATCH] Btrfs-progs: fix compile warning in is_ssd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mkfs.c: In function ‘is_ssd’:
mkfs.c:1168:26: warning: ignoring return value of ‘blkid_devno_to_wholedisk’,
declared with attribute warn_unused_result [-Wunused-result]
  blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL);

Signed-off-by: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
---
 mkfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mkfs.c b/mkfs.c
index 6d340cb..bcaca43 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1209,6 +1209,7 @@ static int is_ssd(const char *file)
 	dev_t devno;
 	int fd;
 	char rotational;
+	int ret;
 
 	probe = blkid_new_probe_from_filename(file);
 	if (!probe)
@@ -1220,7 +1221,12 @@ static int is_ssd(const char *file)
 		return 0;
 
 	/* Get whole disk name (not full path) for this devno */
-	blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL);
+	ret = blkid_devno_to_wholedisk(devno,
+			wholedisk, sizeof(wholedisk), NULL);
+	if (ret) {
+		blkid_free_probe(probe);
+		return 0;
+	}
 
 	snprintf(sysfs_path, PATH_MAX, "/sys/block/%s/queue/rotational",
 		 wholedisk);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux