Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1713081rwd; Mon, 15 May 2023 01:49:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6jYvbEDY/3iw06Plq0MDOX/DAX5/aTXbJS2Xw+mJmTWT19vIwcB5SW35Rc62pyFU6DzV5J X-Received: by 2002:a17:902:eccc:b0:1ac:b449:3528 with SMTP id a12-20020a170902eccc00b001acb4493528mr22161390plh.46.1684140578592; Mon, 15 May 2023 01:49:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684140578; cv=pass; d=google.com; s=arc-20160816; b=ZItup84tYRaPyIycedYDnay+AVfIHFWTk2OQcID0u1X/bEaO+C1CD7WPcTCKlVBdmi /jKDr1Q1ODsGWcRRe+WgQsxf+vZcuCsetufsaRmQB7qIXfr45u9GQWQ6iPpYYcujGUSM XcNRRGoaMkYtg527AmBRnsRKSr0r6T0B8iOLLcMnja9lwcijJFNjThlATF89cq5lbG4W ob8UvVplCZVGMwl3UuGQ7FTnnAeX/fINtixsiR2Y3ufrjmdt/UHdNpclVNU+ZBidSVcU 2EF5NxpjQImeUy9aG4XKxQFIierFyI8XxuAMdcEYNiksh+Wj/MiIcAvsZF/El+X3NTGr 9lvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=OtY8q+oe/IBcLLEryTwOAWNzXUryPqXOGzA8cEpCmeU=; b=SYRqfKiKovARc1RkE6M7450gP2wf3bSQ7dOJ6P8SU91BXSZsTtH82Im82lg57o2byH rXcxS1hwWaKQI5j46TaSl8j/4gmlJgRtS0Go9/NhjD6LM4tZxxGD9xPNAWYFvkErmM90 SRSY+erOTA+ZRZXvsdQlDwqq7xqtfNmTVvvfByPEF1FX0czTn5fbkYYRmmXbh/diTmhB whQXZgNJYpEGaOcw4BHADMKjcxxuf8rdWiZgwdDE5FTVYGKlUA3NcBwsxm+ovIsS7E6X VOXMd5KyQum6zo+ZIFPLSBJDoGfL4QETyvzG8NV2G3zBultLylCQqT8OCKuQ2Toj4D40 mKKQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=bHHfBisQ; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mn16-20020a17090b189000b00246e9abad4bsi29341035pjb.85.2023.05.15.01.49.23; Mon, 15 May 2023 01:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=bHHfBisQ; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235725AbjEOIbY (ORCPT + 99 others); Mon, 15 May 2023 04:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239503AbjEOIbD (ORCPT ); Mon, 15 May 2023 04:31:03 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2115.outbound.protection.outlook.com [40.107.255.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE03010F4; Mon, 15 May 2023 01:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQqG5clz7FyXM7rioDQ8U2R+SYI5q3GZGBXaGlLIH5sLPUY0ERAgQ+Jp0Of/VtW/9JCxREw1+DRrRozJUh5IlDytlJZpX2ZcORJ+DNkVH2GstGPrup0NcvzazY7eFzTUoAeloHMRz+l54HV0R3nuZ5eKqeuRfYwPtn2gg/yv/WB+LPeBGTtGnUWPrkowucv1xJtj8IenKIc2TV16UjZiU67+nDJfmvKxZQtmaplFHZKA1md9hcAlFl7FMDMzBSgXelnf00Tp4qZIKFquzUbOvZ4b3YM9OP+anlnQzuBvwj/9z7efIJUcZnN5o/o4JjCc09AaxP9mBbwOAx1rpfb9Ag== 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=OtY8q+oe/IBcLLEryTwOAWNzXUryPqXOGzA8cEpCmeU=; b=kPq2SfV+pCSTm0DfMuwZqWAU3lk/5h4GSRGGyyM3XafMhGBYh3W37XibIgGSwYHMUkwc71Gkm8/B+yWDMPednkUda2Ra6aH6AqF4Z/9MhyZNCwdIUDN5YbkgGnSJc2lkB/gLCZdAwXb1Hp4JKVejoLC50UktOU626mYeutWn+p4eflCeP6daR39n/vh+1DUUKN6MVFhRytjh6U36upMUfkYWSrNVnlFS1TYxZmvaqFYJHAjWe6FOrCRKvZG7UNY65DXXMVISjFc3rsEPqksHbqkyKzksqIYUeUJ4aIKNmNcD+pQ6ViYhXE8zBdWMC9MZT1SSyjGtKgcxQNNWtF/Yaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OtY8q+oe/IBcLLEryTwOAWNzXUryPqXOGzA8cEpCmeU=; b=bHHfBisQV/Mqw5rZ3XigD8tK79BbOtCOhak1UR9iDHA6iyOP/8tzWAFkClRHfhxYmCcRV5qx6KqH4jjeE8JL7hdo6/y6XrUzuOUIFSLXxfIFULU7VD3py57kniq5tflkd7ZpdPW0lvmCHhIe40Pwcn0mnpnblc+xRkzBXCeY3ukf77i3zI7fEGnbMzoCPvn8XYdHzfRCOoE+V9mycW3tDi4zarCpk3r8rCbJKnWbdnEm9YBVYBY8q/aZGzbxF3ed84Yt/7I8G8Grl5lt3BB7wo5qy9teFchz3l6rXoJpfQu6FeKiVWDVAewJorlRkowzu1ow5n5wrsbDLQawE9vwMw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SG2PR06MB2169.apcprd06.prod.outlook.com (2603:1096:4:7::21) by PUZPR06MB5617.apcprd06.prod.outlook.com (2603:1096:301:e9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Mon, 15 May 2023 08:26:43 +0000 Received: from SG2PR06MB2169.apcprd06.prod.outlook.com ([fe80::51d5:9a57:618e:bb10]) by SG2PR06MB2169.apcprd06.prod.outlook.com ([fe80::51d5:9a57:618e:bb10%3]) with mapi id 15.20.6387.030; Mon, 15 May 2023 08:26:43 +0000 From: luhongfei To: Pavel Machek , Lee Jones , Thierry Reding , Anjelique Melendez , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Conor Dooley , Dmitry Baryshkov , Bjorn Andersson , luhongfei <11117923@bbktel.com>, linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, luhongfei@vivo.com Subject: [PATCH] led: qcom-lpg: Fix bugs in lpg_add_led & lpg_probe Date: Mon, 15 May 2023 16:26:20 +0800 Message-Id: <20230515082622.24551-1-luhongfei@vivo.com> X-Mailer: git-send-email 2.39.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: KL1PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:820:f::15) To SG2PR06MB2169.apcprd06.prod.outlook.com (2603:1096:4:7::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PR06MB2169:EE_|PUZPR06MB5617:EE_ X-MS-Office365-Filtering-Correlation-Id: 73a405c7-ab47-416a-bd3a-08db551e1d6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dqeqgAhxuTGufEt+rzzhgm7x++1OhAzxaxKKz3cLO1U5O8wqXJpZNNUiuFhTUSK0aZkur5GUrxXa3FoRm9h7dJPbnKMHTycreBvQKdZBcerYL6alUWW/Xx8iEECYC5JzXuDrVd6FYXZlTcORCrLCQggG6Kxz/LII5ayPNmLig3oSSF1QFEvOjvr6UxRe1d5R3GQPeffwBrlsS4alT65HnNWNgPSJAw7oIrrfcMX4xRINM/Z3iFFz13dtodgOjYAzbA0c/aEwYrHrhtwVsD/ipV8egQSUWaQPvrWpYc0edLoCvGL59+aTSuncz8rX6w2UwIjDQN8FUimbzKcj/oEhZe+BzMAnXyW1ihYzrPDUzFCyOr78lvLe2X9SfMkd+IFBhbLujSOQpEZ/35yNtyG8ifyaC7uU8V9OWnYDqeL/hD+dAeTNc9ftatib0l7nBD/hyzz9SIpwteT6FBgj0n30Yy6ZmZRDk/Bk4NDsK3b7NMuIOiE4J7MmoQilLmxP3aScxF4BIxAD5JtuYuTWx5DdYggB+m6xiBcEQ/y/l3VbkTCV6cli5BH6TOqpQ8t7toU8Capw6clceyYyPA8TjBEeiTqPpeM1i8AS97CLZJp0gzccARY7qwzKnr7tFtH1XjlzyyFxKkFjFnsCMnYeGRANIw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR06MB2169.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(366004)(451199021)(36756003)(86362001)(110136005)(316002)(66556008)(66946007)(66476007)(4326008)(52116002)(6486002)(478600001)(8936002)(8676002)(5660300002)(6666004)(2906002)(7416002)(38350700002)(38100700002)(921005)(41300700001)(6512007)(2616005)(26005)(107886003)(1076003)(186003)(6506007)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cBUF58lu7oWiGOSCj6Otd/YwXAjpteL/N0jic9aMA5PcwfNMF6Bk4N1vxQ+z?= =?us-ascii?Q?dcedFy/a2GIhqbIbESZmV93rhgXbSbZylOTpRmPYw85e2KuMsMmLy0mCpjML?= =?us-ascii?Q?ZZqMvTKLZIF6eI+NVLtGg2QXex/dhU5e4Iy+fFb8edYnnBJByLknVsmot4Sh?= =?us-ascii?Q?X7XH/QOpWtcPw1qD30DkJaDPgs24s7MKrN9YNF1bM/O9kjBmblVzzNUQFjM8?= =?us-ascii?Q?cEIuODfMyBKiu1+6wYZgr+7A1fGLWXp2tbBjwwH6GQJCwmNaO/G6uNF20K5n?= =?us-ascii?Q?YIVxSKapkTSLzvBghIKNmB+sS/wOPBRfqA7yScaCdwypDy21KNpAP/Bk0a+s?= =?us-ascii?Q?6plVC0lLKQEMMgunS+5l55mq3UVJxKDJ7xgZfpkLOPF7xJwRYLUxEG/WU2yZ?= =?us-ascii?Q?Vm4JHAhVSzOjNGsJqfKlbLgXBTFFVlGbq+rhlo/qi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qYAoQQ76HV9UVrKy9zh/bFoBngobsroMA5Cx7wftepehBWAOAz?= =?us-ascii?Q?qO/LaYj/IWcG1K4dQI3yo05k9opLALtOJE1E8QfWtDR7KHYvJ2Io1vm3Yf2w?= =?us-ascii?Q?HUokvyYSHfvN4GYZtxNG/tUNJzkuT54xTk6mZovqw+55lYLoY2wjv/4zr3ys?= =?us-ascii?Q?SHXCRIDqx8l63HieEb57dgH59RqW2MtibMLFdw/DPF/VuURRVmVVMivscE/4?= =?us-ascii?Q?Jngp5+5FWVoJdg2jtGJgDBJf4v+TpHRykXcpfj+8?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73a405c7-ab47-416a-bd3a-08db551e1d6c X-MS-Exchange-CrossTenant-AuthSource: SG2PR06MB2169.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 08:26:43.6462 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q/u3ZKcOevXK1PteDhF9ZlIU2CzlbypTW3+mVz3bMuvf9bLcAg4C4q/pd5khhES8w8+XBMqXXY+F8tcvxuwXUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5617 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org for_each_available_child_of_node in lpg_probe and lpg_add_led need to execute of_node_put before return. this patch could fix this bug. Signed-off-by: luhongfei --- drivers/leds/rgb/leds-qcom-lpg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/leds/rgb/leds-qcom-lpg.c diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c index 55a037234df1..0e8ff36c4bf7 --- a/drivers/leds/rgb/leds-qcom-lpg.c +++ b/drivers/leds/rgb/leds-qcom-lpg.c @@ -1173,8 +1173,10 @@ static int lpg_add_led(struct lpg *lpg, struct device_node *np) i = 0; for_each_available_child_of_node(np, child) { ret = lpg_parse_channel(lpg, child, &led->channels[i]); - if (ret < 0) + if (ret < 0) { + of_node_put(child); return ret; + } info[i].color_index = led->channels[i]->color; info[i].intensity = 0; @@ -1352,8 +1354,10 @@ static int lpg_probe(struct platform_device *pdev) for_each_available_child_of_node(pdev->dev.of_node, np) { ret = lpg_add_led(lpg, np); - if (ret) + if (ret) { + of_node_put(np); return ret; + } } for (i = 0; i < lpg->num_channels; i++) -- 2.39.0