blob: 658246add67e70e600b77d5e9511f7aeda319638 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 2229f3b9fd4bad47794c28e558ad273173cea73d Mon Sep 17 00:00:00 2001
2From: Andrea Adami <andrea.adami@gmail.com>
3Date: Sat, 27 Jan 2018 09:52:46 +0100
4Subject: [PATCH 9/9] Eliminate warnings about implicit non-const casting in
5 libmtd
6
7The mtd_get_dev_info1 function reads (among other things) name and type
8string into coresponding struct mtd_dev_info fields.
9
10The struct mtd_dev_info has the string fields marked const, requiring
11them to be cast to non-const version during initialization.
12
13This cast was previously omitted from the dev_read_data calls,
14triggering warnings during compilation.
15
16Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
17Signed-off-by: Richard Weinberger <richard@nod.at>
18
19Upstream-Status: Backport
20
21Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
22---
23 lib/libmtd.c | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26diff --git a/lib/libmtd.c b/lib/libmtd.c
27index 60b4782..5f0bcbc 100644
28--- a/lib/libmtd.c
29+++ b/lib/libmtd.c
30@@ -746,13 +746,13 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
31 if (dev_get_major(lib, mtd_num, &mtd->major, &mtd->minor))
32 return -1;
33
34- ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name,
35+ ret = dev_read_data(lib->mtd_name, mtd_num, (char *)&mtd->name,
36 MTD_NAME_MAX + 1);
37 if (ret < 0)
38 return -1;
39 ((char *)mtd->name)[ret - 1] = '\0';
40
41- ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str,
42+ ret = dev_read_data(lib->mtd_type, mtd_num, (char *)&mtd->type_str,
43 MTD_TYPE_MAX + 1);
44 if (ret < 0)
45 return -1;
46--
472.7.4
48