Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From 2229f3b9fd4bad47794c28e558ad273173cea73d Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sat, 27 Jan 2018 09:52:46 +0100 |
| 4 | Subject: [PATCH 9/9] Eliminate warnings about implicit non-const casting in |
| 5 | libmtd |
| 6 | |
| 7 | The mtd_get_dev_info1 function reads (among other things) name and type |
| 8 | string into coresponding struct mtd_dev_info fields. |
| 9 | |
| 10 | The struct mtd_dev_info has the string fields marked const, requiring |
| 11 | them to be cast to non-const version during initialization. |
| 12 | |
| 13 | This cast was previously omitted from the dev_read_data calls, |
| 14 | triggering warnings during compilation. |
| 15 | |
| 16 | Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> |
| 17 | Signed-off-by: Richard Weinberger <richard@nod.at> |
| 18 | |
| 19 | Upstream-Status: Backport |
| 20 | |
| 21 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 22 | --- |
| 23 | lib/libmtd.c | 4 ++-- |
| 24 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 25 | |
| 26 | diff --git a/lib/libmtd.c b/lib/libmtd.c |
| 27 | index 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 | -- |
| 47 | 2.7.4 |
| 48 | |