From patchwork Sat Oct 22 07:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105814wrr; Sat, 22 Oct 2022 01:36:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79LzoYJcADiZbp0fc2DXN7/59liJfKAx9mH+LGt977T0YSnYYX1N0MrE8JD20Rj2QHYtmW X-Received: by 2002:a63:f206:0:b0:446:eb31:47e0 with SMTP id v6-20020a63f206000000b00446eb3147e0mr20068052pgh.491.1666427773287; Sat, 22 Oct 2022 01:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427773; cv=none; d=google.com; s=arc-20160816; b=LP0QpwnDwwcdeke8rtJdVoji65SyUzSvZv+ErsxY9r4ix3Ne3Uw+BkP7Z7yiHKZwBk wODgmP56tgkbTt46ejZIn6rDJ1jbHlwmsIKRK972irruzmfYeQF5f61nEwDYUdNYEiTm ANgQZV1Z8EzLeOZX+Ph85nlyfK2L+ohHTFGxOJlOdArncv4Yx87a2VODE3eN3MKdjPSi m+eKiEjQRH4ww9yekgoWTwokZZ2u8QcFyUOnUBSenNvvA6fSlj36nIdv+nC5IS60jaIs kQ86AiDyqD9d+qfGnGJ0yJrHmYjmV+tPYxgGoJJ+bCoeXvjiVvTMHz7XjUIqq5Fladqh /3mA== 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=B0Vpnh2qi2HOWopR5QXQqOnOu1w3vAKM255mQ1Oee/esWBhXN04EBuSNaZMTxYg2St JWqOOoGgR0u/4FSuHOUdsDm7/ilZJEIFUqk5Zz+OAYPW7/7rDFgzVn1ox4oBhwvH6qqv U8MHIwxY2IKjjuy4S5/Z8AyIaCFas+heyoFmyYYytTyWlXbZoMB80vBsasG5rfgD/Bu7 GZ33rXD7y8fT0/sKVr2z4ZuZsk9jLDzSex2+AXRYvU+y/Hx7cGBylB4Fw2BHXYtlUECg hS/0DSZguRhVs7akASH1N/NdeHM+cjNuZqNr7HwUD+1QVj8IPxRa4dTdSrgfhtPf9Ukv Gw2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E0q5V2HQ; 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 k71-20020a63844a000000b0045724b1e357si27673163pgd.683.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36:13 -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=E0q5V2HQ; 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 S230097AbiJVIZ0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233695AbiJVIWn (ORCPT ); Sat, 22 Oct 2022 04:22:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63BA13A58A; Sat, 22 Oct 2022 00:59:08 -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 ams.source.kernel.org (Postfix) with ESMTPS id CA9F3B82DF9; Sat, 22 Oct 2022 07:58:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11740C433C1; Sat, 22 Oct 2022 07:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425524; bh=wpNuhBG9/6aQ2W+7cbuETNqCLtVcvtJT1YSt5RjOQ6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0q5V2HQ+bkOJSmdCytPHEyTlRt5hvZ+/DuEydR5VVgK4zCGrja01Zcf4ff0iootc vcBip9IFcmcr8r47ubvq138IeHGtfrp7mWUZ6YfkcDyPquXmQOqfQJBGrlp19PaCl6 32B8Sxs4Ce3tU3UHOSxb2J/XTTDwXwDrLv5vNZFA= 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 5.19 522/717] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Date: Sat, 22 Oct 2022 09:26:41 +0200 Message-Id: <20221022072521.392405978@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376168761706820?= X-GMAIL-MSGID: =?utf-8?q?1747376168761706820?= 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[] = {