hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/base/regmap/regcache.c
....@@ -1,14 +1,10 @@
1
-/*
2
- * Register cache access API
3
- *
4
- * Copyright 2011 Wolfson Microelectronics plc
5
- *
6
- * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- */
1
+// SPDX-License-Identifier: GPL-2.0
2
+//
3
+// Register cache access API
4
+//
5
+// Copyright 2011 Wolfson Microelectronics plc
6
+//
7
+// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
128
139 #include <linux/bsearch.h>
1410 #include <linux/device.h>
....@@ -347,6 +343,9 @@
347343 const char *name;
348344 bool bypass;
349345
346
+ if (WARN_ON(map->cache_type == REGCACHE_NONE))
347
+ return -EINVAL;
348
+
350349 BUG_ON(!map->cache_ops);
351350
352351 map->lock(map->lock_arg);
....@@ -415,6 +414,9 @@
415414 int ret = 0;
416415 const char *name;
417416 bool bypass;
417
+
418
+ if (WARN_ON(map->cache_type == REGCACHE_NONE))
419
+ return -EINVAL;
418420
419421 BUG_ON(!map->cache_ops);
420422
....@@ -721,7 +723,7 @@
721723
722724 map->cache_bypass = true;
723725
724
- ret = _regmap_raw_write(map, base, *data, count * val_bytes);
726
+ ret = _regmap_raw_write(map, base, *data, count * val_bytes, false);
725727 if (ret)
726728 dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
727729 base, cur - map->reg_stride, ret);