Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp801632rwi; Wed, 19 Oct 2022 03:11:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57++doNJZvnBSm1rr3lMix+wZU+qSWQ8Oomg+4IgPLKltB1Y8p5q2Xi/tjrIiive8SgtIS X-Received: by 2002:a17:906:846b:b0:78d:f3b9:aadf with SMTP id hx11-20020a170906846b00b0078df3b9aadfmr6103428ejc.731.1666174298980; Wed, 19 Oct 2022 03:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174298; cv=none; d=google.com; s=arc-20160816; b=p+zg+Rjj+aE2mGOGvrO0U+IZpfCVnvW/HHYReMViE8qti4C/vBNoJFnGGP0h7PIAjg M5gNiLTK8cw98WOCYUdbmx/oewyFdBAv0D+BJeLNFKwWjkr9HCvvmV9z/b/VhVGslYkA GiDrdWRAaJvxmoxqpP0Frkc8KaNaSCce1rHae1LbLV7EQsCaV1HhjRXI5m2gdVv8Mamd +qdDR7TJbSK1H4FsIXgBV5r6zrNfY4ieUnItul3pXNuAKPp3QA0kvv88zXfLBo8SpzPv DW6ebW7k1Pyq0aOo9agEXQXxaioem69u4iY3IIQ/yv/OM1MbAltMEv2ceuXKuMLTIv5r gK1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3NVHu8D43K6DlPVGRW9e7kWOFKqnCWmQnn3uBDk2xvM=; b=BHSKAj4zmG51ThxpObSS7hTg/kvwMH3HOCQZtTAjV74eOQPAgFcE7VeaMe41D7cpN6 3KFJ1k2mNSl3++Tl3W6ylb9TPDe3/I4cPE17sXNBK0+WuQIP18sbbShUinygN6wNGmR3 klcoGFj6jSnMLGwunaBVjmqh+1QgLjH/XjoT/tGFcZ9Q+yo27/rxeR6lIMIGDVcbr2LY 7CikSxhf9ZNb8/WClNQ3UMElFg30MjsQw0vP/vH1MRKg12a1tTabqyCt0EX+ZObDeLnQ eP4NydsnbXtb7ul5WSPnwvW8d/zHbcmYINP+o+fxwlYwlDJFNgrTV4tA0AQQrsiDCknL VZXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vCtufBv9; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402510e00b0045dc25bb7easi5758216edd.555.2022.10.19.03.11.09; Wed, 19 Oct 2022 03:11: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=@linuxfoundation.org header.s=korg header.b=vCtufBv9; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbiJSJc3 (ORCPT + 99 others); Wed, 19 Oct 2022 05:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbiJSJ2h (ORCPT ); Wed, 19 Oct 2022 05:28:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C2CE6F6B; Wed, 19 Oct 2022 02:12:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13A416182F; Wed, 19 Oct 2022 09:08:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26617C433D6; Wed, 19 Oct 2022 09:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170483; bh=wpNuhBG9/6aQ2W+7cbuETNqCLtVcvtJT1YSt5RjOQ6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCtufBv9LIRRgLq0F3T+DsJmUAjZrsZjD7C2wYZ4ucA4Y6fZUQei/uhpjrkmgVQDX 1xguqL4tV+It8NlcS9tMtGXGjXw3lldaNgjVFgkfkELLOUSNuUHzetXq4/CufiWv7z riLHZna7RO924B8wkfxzwTzDCbacCMW5+z3CVsCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Daniel Lezcano , Sasha Levin Subject: [PATCH 6.0 640/862] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Date: Wed, 19 Oct 2022 10:32:07 +0200 Message-Id: <20221019083318.199357367@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Lin Yujun [ Upstream commit 0e2c8e6d769bcdc4f6634a02c545356282275e68 ] Add platform_device_put() to make sure to free the platform device in the event platform_device_add() fails. Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer") Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914033018.97484-1-linyujun809@huawei.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/timer-gxp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c index 8b38b3212388..fe4fa8d7b3f1 100644 --- a/drivers/clocksource/timer-gxp.c +++ b/drivers/clocksource/timer-gxp.c @@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev) { struct platform_device *gxp_watchdog_device; struct device *dev = &pdev->dev; + int ret; if (!gxp_timer) { pr_err("Gxp Timer not initialized, cannot create watchdog"); @@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev) gxp_watchdog_device->dev.platform_data = gxp_timer->counter; gxp_watchdog_device->dev.parent = dev; - return platform_device_add(gxp_watchdog_device); + ret = platform_device_add(gxp_watchdog_device); + if (ret) + platform_device_put(gxp_watchdog_device); + + return ret; } static const struct of_device_id gxp_timer_of_match[] = { -- 2.35.1