From: Henry Chen <henryc.chen@mediatek.com>
To: Mark Brown <broonie@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
Sascha Hauer <kernel@pengutronix.de>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <henryc.chen@mediatek.com>,
<eddie.huang@mediatek.com>
Subject: [PATCH] regmap: Add function check before called format_val
Date: Mon, 20 Jul 2015 20:41:50 +0800 [thread overview]
Message-ID: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com> (raw)
The regmap_format will not be initialize since regmap_bus is not assgined
on regmap_init(). It should has a function check before using
format_val() to avoid null function called on regmap_bulk_read().
Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
---
Based on v4.2rc1
---
drivers/base/regmap/regmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7111d04..c1e8c32 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2317,7 +2317,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
&ival);
if (ret != 0)
return ret;
- map->format.format_val(val + (i * val_bytes), ival, 0);
+ if (map->format.format_val)
+ map->format.format_val(val + (i * val_bytes), ival, 0);
+ else
+ memcpy(val + (i * val_bytes), &ival, val_bytes);
}
}
--
1.8.1.1.dirty
WARNING: multiple messages have this Message-ID (diff)
From: Henry Chen <henryc.chen@mediatek.com>
To: Mark Brown <broonie@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
Sascha Hauer <kernel@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
henryc.chen@mediatek.com, eddie.huang@mediatek.com
Subject: [PATCH] regmap: Add function check before called format_val
Date: Mon, 20 Jul 2015 20:41:50 +0800 [thread overview]
Message-ID: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com> (raw)
The regmap_format will not be initialize since regmap_bus is not assgined
on regmap_init(). It should has a function check before using
format_val() to avoid null function called on regmap_bulk_read().
Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
---
Based on v4.2rc1
---
drivers/base/regmap/regmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7111d04..c1e8c32 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2317,7 +2317,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
&ival);
if (ret != 0)
return ret;
- map->format.format_val(val + (i * val_bytes), ival, 0);
+ if (map->format.format_val)
+ map->format.format_val(val + (i * val_bytes), ival, 0);
+ else
+ memcpy(val + (i * val_bytes), &ival, val_bytes);
}
}
--
1.8.1.1.dirty
WARNING: multiple messages have this Message-ID (diff)
From: henryc.chen@mediatek.com (Henry Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] regmap: Add function check before called format_val
Date: Mon, 20 Jul 2015 20:41:50 +0800 [thread overview]
Message-ID: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com> (raw)
The regmap_format will not be initialize since regmap_bus is not assgined
on regmap_init(). It should has a function check before using
format_val() to avoid null function called on regmap_bulk_read().
Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
---
Based on v4.2rc1
---
drivers/base/regmap/regmap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7111d04..c1e8c32 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2317,7 +2317,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
&ival);
if (ret != 0)
return ret;
- map->format.format_val(val + (i * val_bytes), ival, 0);
+ if (map->format.format_val)
+ map->format.format_val(val + (i * val_bytes), ival, 0);
+ else
+ memcpy(val + (i * val_bytes), &ival, val_bytes);
}
}
--
1.8.1.1.dirty
next reply other threads:[~2015-07-20 12:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 12:41 Henry Chen [this message]
2015-07-20 12:41 ` [PATCH] regmap: Add function check before called format_val Henry Chen
2015-07-20 12:41 ` Henry Chen
2015-07-20 15:02 ` Mark Brown
2015-07-20 15:02 ` Mark Brown
2015-07-21 6:07 ` Henry Chen
2015-07-21 6:07 ` Henry Chen
2015-07-21 6:07 ` Henry Chen
2015-07-21 17:25 ` Mark Brown
2015-07-21 17:25 ` Mark Brown
2015-07-22 14:31 ` Henry Chen
2015-07-22 14:31 ` Henry Chen
2015-07-22 14:31 ` Henry Chen
2015-07-22 17:00 ` Mark Brown
2015-07-22 17:00 ` Mark Brown
2015-08-12 14:20 ` Daniel Kurtz
2015-08-12 14:20 ` Daniel Kurtz
2015-08-13 15:25 ` Henry Chen
2015-08-13 15:25 ` Henry Chen
2015-08-14 17:56 ` Mark Brown
2015-08-14 17:56 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437396110-5192-1-git-send-email-henryc.chen@mediatek.com \
--to=henryc.chen@mediatek.com \
--cc=broonie@kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.