Return-Path: Received: from mail-wi0-f177.google.com ([209.85.212.177]:36617 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbbG0IWV (ORCPT ); Mon, 27 Jul 2015 04:22:21 -0400 Received: by wicgb10 with SMTP id gb10so100742211wic.1 for ; Mon, 27 Jul 2015 01:22:20 -0700 (PDT) Received: from ?IPv6:2a01:4240:53f0:43fb::cbb? (b.b.c.0.0.0.0.0.0.0.0.0.0.0.0.0.b.f.3.4.0.f.3.5.0.4.2.4.1.0.a.2.v6.cust.nbox.cz. [2a01:4240:53f0:43fb::cbb]) by smtp.gmail.com with ESMTPSA id bu12sm19797571wjb.44.2015.07.27.01.22.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 01:22:20 -0700 (PDT) From: Jiri Slaby To: jslaby@suse.com Cc: Arun Chandran , Mark Brown , Jiri Slaby Subject: [patch added to the 3.12 stable tree] regmap: Fix regmap_bulk_read in BE mode Date: Mon, 27 Jul 2015 10:02:23 +0200 Message-Id: <1437984150-15702-42-git-send-email-jslaby@suse.com> In-Reply-To: <1437984150-15702-1-git-send-email-jslaby@suse.com> References: <1437984150-15702-1-git-send-email-jslaby@suse.com> Sender: stable-owner@vger.kernel.org List-ID: From: Arun Chandran This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit 15b8d2c41fe5839582029f65c5f7004db451cc2b upstream. In big endian mode regmap_bulk_read gives incorrect data for byte reads. This is because memcpy of a single byte from an address after full word read gives different results when endianness differs. ie. we get little-end in LE and big-end in BE. Signed-off-by: Arun Chandran Signed-off-by: Mark Brown Signed-off-by: Jiri Slaby --- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 9f7990187653..45aec73d09bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1736,7 +1736,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, &ival); if (ret != 0) return ret; - memcpy(val + (i * val_bytes), &ival, val_bytes); + map->format.format_val(val + (i * val_bytes), ival, 0); } } -- 2.4.6