From patchwork Tue Apr 20 19:46:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 424974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9558DC433ED for ; Tue, 20 Apr 2021 19:46:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A684613E4 for ; Tue, 20 Apr 2021 19:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233681AbhDTTqz (ORCPT ); Tue, 20 Apr 2021 15:46:55 -0400 Received: from smtp11.smtpout.orange.fr ([80.12.242.133]:54884 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233544AbhDTTqz (ORCPT ); Tue, 20 Apr 2021 15:46:55 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d34 with ME id v7mF2400D21Fzsu037mFED; Tue, 20 Apr 2021 21:46:16 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 20 Apr 2021 21:46:16 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: eajames@linux.ibm.com, broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] spi: fsi: add a missing of_node_put Date: Tue, 20 Apr 2021 21:46:13 +0200 Message-Id: <504e431b900341249d331b868d90312cf41f415a.1618947919.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org 'for_each_available_child_of_node' performs an of_node_get on each iteration, so a return from the middle of the loop requires an of_node_put. Fixes: bbb6b2f9865b ("spi: Add FSI-attached SPI controller driver") Signed-off-by: Christophe JAILLET --- drivers/spi/spi-fsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsi.c b/drivers/spi/spi-fsi.c index de359718e816..87f8829c3995 100644 --- a/drivers/spi/spi-fsi.c +++ b/drivers/spi/spi-fsi.c @@ -566,8 +566,10 @@ static int fsi_spi_probe(struct device *dev) continue; ctlr = spi_alloc_master(dev, sizeof(*ctx)); - if (!ctlr) + if (!ctlr) { + of_node_put(np); break; + } ctlr->dev.of_node = np; ctlr->num_chipselect = of_get_available_child_count(np) ?: 1;