linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] gpio: gpiolib: clear the array_info's memory space
@ 2023-04-23 11:03 Yan Wang
  2023-04-23 13:09 ` kernel test robot
  2023-04-23 13:41 ` kernel test robot
  0 siblings, 2 replies; 11+ messages in thread
From: Yan Wang @ 2023-04-23 11:03 UTC (permalink / raw)
  To: linus.walleij, brgl; +Cc: Yan Wang, open list:GPIO SUBSYSTEM, open list

if hardware number different to array index,it needs to clear to points
memory space if the array_info have been assigned a value.

Signed-off-by: Yan Wang <rk.code@outlook.com>
---
 drivers/gpio/gpiolib.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 04fb05df805b..cdaffcdd45b2 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4340,8 +4340,11 @@ struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
 		}
 
 		/* If there is no cache for fast bitmap processing path, continue */
-		if (!array_info)
+		if (!array_info) {
+			/*clear descs->info*/
+			memset(array_info, 0, sizeof(struct gpio_array));
 			continue;
+		}
 
 		/* Unmark array members which don't belong to the 'fast' chip */
 		if (array_info->chip != gc) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-15  7:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-23 11:03 [PATCH v1] gpio: gpiolib: clear the array_info's memory space Yan Wang
2023-04-23 13:09 ` kernel test robot
2023-04-23 13:41 ` kernel test robot
2023-04-23 13:59   ` [PATCH v2] " Yan Wang
2023-04-26 14:42     ` andy.shevchenko
2023-04-27  6:13       ` Yan Wang
2023-05-04  9:36       ` Yan Wang
2023-05-04 11:36         ` Andy Shevchenko
2023-05-04 14:15           ` Yan Wang
2023-05-12  7:37             ` Yan Wang
2023-05-15  7:25     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).