Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210332 > unrolled thread

[PATCH v2 0/5] regmap: fixes

Started byMarkus Pargmann <mpa@pengutronix.de>
First post2015-08-20 11:20 +0200
Last post2015-08-20 20:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/5] regmap: fixes Markus Pargmann <mpa@pengutronix.de> - 2015-08-20 11:20 +0200
    [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read Markus Pargmann <mpa@pengutronix.de> - 2015-08-20 11:20 +0200
      Re: [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read Mark Brown <broonie@kernel.org> - 2015-08-20 20:40 +0200

#1210332 — [PATCH v2 0/5] regmap: fixes

FromMarkus Pargmann <mpa@pengutronix.de>
Date2015-08-20 11:20 +0200
Subject[PATCH v2 0/5] regmap: fixes
Message-ID<pZuaR-wx-3@gated-at.bofh.it>
Hi,

These are some regmap fixes from the previous series
"Regmap max_raw_io and bmc150 SPI support". They are now splitted from the
other patches.

Changes in v2:
- Fixed free_context typo
- use_single_rw is now internally split into use_single_read/write
- Removed patches that wrongly tried to fix things
- Added simpler patches which check for the existence of bus->read/write to
  avoid null dereferences

Best Regards,

Markus


Markus Pargmann (5):
  regmap: Add missing comments about struct regmap_bus
  regmap: Fix regmap_bulk_write for bus writes
  regmap: Split use_single_rw internally into use_single_read/write
  regmap: regmap_raw_read return error on !bus->read
  regmap: No multi_write support if bus->write does not exist

 drivers/base/regmap/internal.h   |  6 ++++--
 drivers/base/regmap/regcache.c   |  2 +-
 drivers/base/regmap/regmap-irq.c |  4 ++--
 drivers/base/regmap/regmap.c     | 31 ++++++++++++++++++++++++++-----
 include/linux/regmap.h           |  4 +++-
 5 files changed, 36 insertions(+), 11 deletions(-)

-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1210334 — [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read

FromMarkus Pargmann <mpa@pengutronix.de>
Date2015-08-20 11:20 +0200
Subject[PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read
Message-ID<pZuaT-wx-41@gated-at.bofh.it>
In reply to#1210332
Return -ENOTSUPP if map->bus->read is not implemented and we do not use
the cache. This code path would directly use bus->read would run into an
NULL pointer for the read function.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/base/regmap/regmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index bb4e65e7a950..66efe25d64c9 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2201,6 +2201,11 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
 	if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
 	    map->cache_type == REGCACHE_NONE) {
+		if (!map->bus->read) {
+			ret = -ENOTSUPP;
+			goto out;
+		}
+
 		/* Physical block read if there's no cache involved */
 		ret = _regmap_raw_read(map, reg, val, val_len);
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1210671 — Re: [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read

FromMark Brown <broonie@kernel.org>
Date2015-08-20 20:40 +0200
SubjectRe: [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read
Message-ID<pZCUN-4Dv-11@gated-at.bofh.it>
In reply to#1210334

[Multipart message — attachments visible in raw view] — view raw

On Thu, Aug 20, 2015 at 11:12:35AM +0200, Markus Pargmann wrote:
> Return -ENOTSUPP if map->bus->read is not implemented and we do not use
> the cache. This code path would directly use bus->read would run into an
> NULL pointer for the read function.

Please put fixes like this before coding style changes like patch 3.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web