From patchwork Wed Oct 19 08:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp225370wrs; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xIMRbunLroS3Ab7Oy5cyPAh/uUCSicF4uESB81/GrsfQgLg7GCAnHcAlTzZkeve61KUya X-Received: by 2002:a17:906:eecb:b0:73c:5c85:142b with SMTP id wu11-20020a170906eecb00b0073c5c85142bmr5956489ejb.433.1666172579441; Wed, 19 Oct 2022 02:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172579; cv=none; d=google.com; s=arc-20160816; b=sZOjhNXi0qAXUZSpNMimadRT7pdhIfvuH5J3Q6gmTR6m9+5qB2GrUKqj+MOTUKs3xD KfJU5ctV3MenUDQ8pX3Hq/xPKzthoayhmFigZkBs7spvxyW0YmWzSRNllVu94oCe8FoX JXH8QZG4M/JtAzLyrAW59SG8SVNq7PW8gOBNogWRHTHZSx0EGMTh9rXa5LGv9zn9O+wl NjJVcdf5/7jRQBUJPJ/eXUxsNkgTEZZy3MQ561s0LJpJ2Rl6SPhqlmsgcJfOSUdPvNHx nrF03Cagu57Rryf0hiiQM9Ui3jQ6KItY+VDSrXkmoeqixiqg5cjUN31epIRiwLARW/b4 B8Bw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a101-20020a509eee000000b00457f5aa9dc6si13265961edf.528.2022.10.19.02.42.33; Wed, 19 Oct 2022 02:42:59 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108578568782685?= X-GMAIL-MSGID: =?utf-8?q?1747108578568782685?= 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[] = {