From patchwork Sun Apr 23 11:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Wang X-Patchwork-Id: 677024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 634E7C77B73 for ; Sun, 23 Apr 2023 11:03:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbjDWLDp (ORCPT ); Sun, 23 Apr 2023 07:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjDWLDo (ORCPT ); Sun, 23 Apr 2023 07:03:44 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01olkn2037.outbound.protection.outlook.com [40.92.52.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A43F10DB; Sun, 23 Apr 2023 04:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HJvJftYG+4sgWb6sHix7+oX15pplY5L8IA3oyFwTtJcjjkN8TaFwhQHWCwjTReqC6T6JRW1AzkdDifP+JDn+o15yj0rrMekSdUrsQxVSigrXnEMFzZ8z5Z1M2kDYtHsTnLPjF+qLtAfS4/3a2B/zAOE+aj09ll5spfktYJNr/OgDaJu9ljz0zrRWlfwU5S1NYX+VG1tX8PAl2MrRufK9bmhIXYGfs6isPEvbBHk4g2WUqrZjqd698XahmTSe1GMEyBBy6HUNdjyFexi0reU0vOhA6oN+Ci4YI6blB6Qbjq1MPfFCNL93d3J5dAm9x8Xbp23RMvNCAG0JORxv2j9hpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Cd61zKD5M1u+h+Fb84FHcOWxRBKGnWR/DPdIkKnoLfM=; b=Qor8cnN7csbjhATU7t5im5GFnf8XeggXGzv+SzkpeURln1wPP7YWhnhRQbHPSZ5+lHQ97NJMlSgqHf34bCMJM/zk9MLpsrO1PiH8P3QTCO/BC2TAAH+T7lOe019od18qtB4DHcJVp3d4+yP6/xmeWHjhutDd8naaY0/kXwxtQTdxN4t3DofgDm7hs60mkAgQRZJ602lr88BPynpGzxLcFHRvYfY3KoLSV2ttcNau6vr86Rd11nbCpN+jFmbjiOfiTzyBGX6un3Bzdzot2bgKxC/NgO/5KMPP3UwhlotVGeiw+W5Arg9Ze3QqjF300LklO6pXrao6sbQ7pfUlsaP79A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Cd61zKD5M1u+h+Fb84FHcOWxRBKGnWR/DPdIkKnoLfM=; b=SiGZInJPFzgciFBIP9fm461KGVuDr7/1ayVrVl2vOd5xGh9nn+xAx7HyAFvbHStLh/Si58ITITwGy9enpNF/ltypnSG0hI1u4Kz3zD9+WOOpww8WmX3S+4uksW3K0M5P6igWTV3EG8gpixLSSrY5AbtwZ4UOIfyrMZmMbZVifUlifArH8SObCCVlfBw6zTomEK2W2oO8gIc/cqlKb2T9kf/ioNtFjfTFaSCUgxhKNoXbTZaxbMMO2jWsjevk+D20h5s37hHRtm2e9q02GBeghhWkmD7dYIXb1G8xW4rC6S6gUm23nTDKanX1HF9CI79G5pmI8289PMjhWSTVmdQUSA== Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) by TYSPR01MB5471.apcprd01.prod.exchangelabs.com (2603:1096:400:40f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.18; Sun, 23 Apr 2023 11:03:34 +0000 Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::5bff:fd7e:ec7c:e9d3]) by KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::5bff:fd7e:ec7c:e9d3%5]) with mapi id 15.20.6340.018; Sun, 23 Apr 2023 11:03:34 +0000 From: Yan Wang To: linus.walleij@linaro.org, brgl@bgdev.pl Cc: Yan Wang , linux-gpio@vger.kernel.org (open list:GPIO SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1] gpio: gpiolib: clear the array_info's memory space Date: Sun, 23 Apr 2023 19:03:12 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 X-TMN: [LyQ4LH6PMIy4ErKKWYgZHa/jlPRo9XuU/ivjybGPzQY=] X-ClientProxiedBy: SGXP274CA0014.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::26) To KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) X-Microsoft-Original-Message-ID: <20230423110312.8319-1-rk.code@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR01MB5448:EE_|TYSPR01MB5471:EE_ X-MS-Office365-Filtering-Correlation-Id: 723e6fcf-b07c-4b26-76ba-08db43ea61d8 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKx/5wRYKwbtF7hqq2E99L18eMaQIMe6A5F76rBXiU/m8RnMihKHrMbIH/sdtFJTp9unjrHFiV8KdEeO/E13IjSpPX2iIS/Re84yS2/Fsf63xDRh78kAFVXCw6kXKA32UUfDnqy7kLW0yL0lR2nzcyWTWUjpuRYwYxQ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NQcAsy3FL9EIDxq1WQO+EYhagpWcEI104+3VsRkxTAOWga3ICItI7HAbziA/eyS/GDhqaRkOFYPG0TFqq2o8AVCgl+C8XsuF/CO10HzuV5xt2lI82pu1qXsZ664Nx1wgSF8j7jUDxY8a+xbqXcgIQbodn6p3wXv5zFPUVe0p62OggYuVIoo5QlBE8tvxHcHYp+NRIZHy4UrBr3HkEIFHqL65xdbsmEjcC9JZDuDJHbf+eN3xOYUQYBVuTnGl8ZBBi6kixCV3hw4Sbnmz1ewcr5VtbqyZqm9Yv9Yyi67NhdMeytoAlwfUzPeNW1XDgch/gTflf75KRgeET/F1mFrlESOKybdsZa4lGKpbGzFPrS1GtaCLOITDkkeueR+PuCBNjHZ6Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 723e6fcf-b07c-4b26-76ba-08db43ea61d8 X-MS-Exchange-CrossTenant-AuthSource: KL1PR01MB5448.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2023 11:03:34.7985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR01MB5471 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- 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) {