linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: fix compile warning in is_ssd()
@ 2013-09-04 11:43 Wang Shilong
  0 siblings, 0 replies; only message in thread
From: Wang Shilong @ 2013-09-04 11:43 UTC (permalink / raw)
  To: linux-btrfs

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@cn.fujitsu.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-04 11:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 11:43 [PATCH] Btrfs-progs: fix compile warning in is_ssd() Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).