[PATCH v2 08/13] partitions: msdos: fix one-byte get_unaligned()

From: Arnd Bergmann
Date: Fri May 14 2021 - 06:04:47 EST


From: Arnd Bergmann <arnd@xxxxxxxx>

A simplification of get_unaligned() clashes with callers that pass
in a character pointer, causing a harmless warning like:

block/partitions/msdos.c: In function 'msdos_partition':
include/asm-generic/unaligned.h:13:22: warning: 'packed' attribute ignored for field of type 'u8' {aka 'unsigned char'} [-Wattributes]

Remove the get_unaligned() call and just use the byte directly.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
block/partitions/ldm.h | 2 +-
block/partitions/msdos.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h
index d8d6beaa72c4..1a77ff09cc5f 100644
--- a/block/partitions/ldm.h
+++ b/block/partitions/ldm.h
@@ -85,7 +85,7 @@ struct parsed_partitions;
#define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */

/* Borrowed from msdos.c */
-#define SYS_IND(p) (get_unaligned(&(p)->sys_ind))
+#define SYS_IND(p) ((p)->sys_ind)

struct frag { /* VBLK Fragment handling */
struct list_head list;
diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c
index 8f2fcc080264..d78549d7619d 100644
--- a/block/partitions/msdos.c
+++ b/block/partitions/msdos.c
@@ -38,7 +38,7 @@
*/
#include <asm/unaligned.h>

-#define SYS_IND(p) get_unaligned(&p->sys_ind)
+#define SYS_IND(p) (p->sys_ind)

static inline sector_t nr_sects(struct msdos_partition *p)
{
--
2.29.2