Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4283005rwd; Tue, 30 May 2023 03:13:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ55xRqoxsUyQuAAOKCp5q2rc7Zs60oAtLYXVoSbZTdaL9e7rG5chc1LJdus8/0PSBfhCZcu X-Received: by 2002:a05:6a20:5484:b0:102:a593:a161 with SMTP id i4-20020a056a20548400b00102a593a161mr2229302pzk.57.1685441626148; Tue, 30 May 2023 03:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685441626; cv=none; d=google.com; s=arc-20160816; b=NNwiR/o91jOaFYDQk5gozS3BZdIYKmKaLFW0I1Qaj1MERNTwk0n/sNUDKljL1CN6F0 0OkNjJ1V8CDpo3pwFpc2Y0Qa7fSN/YJsI6YZbFld0kIu3T19lqJ+GqPF82TqkFnntf+i 83YJqplBtKj2zfp/8LgRlAxWFp95QSFXuWfEWQ0zhMHvjDu7PiiBijoe6WkVC2XV6Cot 5Wk/tf6WvbLW/DHxU56zn20UNLjwRVNV1ijUv7ZfWCHYCQgf4BVdyMCpxj4qPilhKm0f FZ0KJPxFR/egxZAFuCXhSPSivsyYIWQxJVa7LOIpKvNNMprGCu6ANpCWob9tJl6nniHm kpXw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7LyxUb0oiNrvEo39MXUMSYofdEHnhDjyN7vjrQdkIY0=; b=Anrebub7yBJljH0m5AJMDxzUMGF8q18mK13Vu0yaE08P9JRkWObj4LsfW+3aDYsRao 2AHNiGhpR0TUpWDW5t2EO6MlrbW3qkpogMlL32N0vw6e741YR909dd5FNiJcfKxp82eb 5Y7IcjqPULENmJZ6sG2K+pAxaB42iuH7hznwMu+PsNOVtNG6/SwUmBscTARH1t/neCK2 /Ud77H8wpfKkADmpVWQftx60aiumy+lYqaGumKxQD3o9xL2rlJEmFMC0QnSaQO60ZJbC ZzUj0AGb9SocQGvf2AZK2EbARugp1unr9kV9UyyNWbNb4dbpo3PvFDLDtUpuCqAlqVuA ICyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=hTVqjvR2; 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=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a636e08000000b00534919e40fcsi5511230pgc.626.2023.05.30.03.13.32; Tue, 30 May 2023 03:13:46 -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=@microchip.com header.s=mchp header.b=hTVqjvR2; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbjE3JkN (ORCPT + 99 others); Tue, 30 May 2023 05:40:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbjE3JkI (ORCPT ); Tue, 30 May 2023 05:40:08 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110A3F0; Tue, 30 May 2023 02:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1685439602; x=1716975602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eULxRW5HiZYtKwH0qN2snrG4MCmtG1cxN6q/9u0F8p4=; b=hTVqjvR2ukbezJJIEWi+nYafV2tQY+O1RpAM+3xlyv+EGbNUWAe7p2t2 pEb2b/7hZxzCpA2XYIFYAhvisg25zfAfBTi3Uaq7Bgv0YMbj/rtSypSYv PrpQOM5z/OLM1C3bozAR4NoovylJYfHtqs1p/ZoKqqlol1YjHQ0p2QiK1 YOvWgmYY/NAG+yClDO5Y+ntB/WIvCVuAf9AOaDBMlZJEBNxGx0rFuv1ff 8ow1kEzkLNem3sQDxM2gdAh/XTVjLRVbjo7MwKOZOQuqgBes1tpKVBxnn NayLh6rz3wOCKASCrhODe+ZbHHK9FIQKLO78HRxfZ+DrniGQcYy4yuYmz w==; X-IronPort-AV: E=Sophos;i="6.00,203,1681196400"; d="scan'208";a="227558620" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 May 2023 02:40:02 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 30 May 2023 02:40:01 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 30 May 2023 02:39:57 -0700 From: Claudiu Beznea To: , , , , , , CC: , , , , , , , , , Claudiu Beznea Subject: [PATCH 5/8] clk: si5341: free unused memory on probe failure Date: Tue, 30 May 2023 12:39:10 +0300 Message-ID: <20230530093913.1656095-6-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530093913.1656095-1-claudiu.beznea@microchip.com> References: <20230530093913.1656095-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Pointers from synth_clock_names[] should be freed at the end of probe either on probe success or failure path. Fixes: b7bbf6ec4940 ("clk: si5341: Allow different output VDD_SEL values") Fixes: 9b13ff4340df ("clk: si5341: Add sysfs properties to allow checking/resetting device faults") Signed-off-by: Claudiu Beznea --- drivers/clk/clk-si5341.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c index b2cf7edc8b30..c7d8cbd22bac 100644 --- a/drivers/clk/clk-si5341.c +++ b/drivers/clk/clk-si5341.c @@ -1744,7 +1744,7 @@ static int si5341_probe(struct i2c_client *client) if (err) { dev_err(&client->dev, "output %u registration failed\n", i); - goto cleanup; + goto free_clk_names; } if (config[i].always_on) clk_prepare(data->clk[i].hw.clk); @@ -1754,7 +1754,7 @@ static int si5341_probe(struct i2c_client *client) data); if (err) { dev_err(&client->dev, "unable to add clk provider\n"); - goto cleanup; + goto free_clk_names; } if (initialization_required) { @@ -1762,11 +1762,11 @@ static int si5341_probe(struct i2c_client *client) regcache_cache_only(data->regmap, false); err = regcache_sync(data->regmap); if (err < 0) - goto cleanup; + goto free_clk_names; err = si5341_finalize_defaults(data); if (err < 0) - goto cleanup; + goto free_clk_names; } /* wait for device to report input clock present and PLL lock */ @@ -1775,21 +1775,19 @@ static int si5341_probe(struct i2c_client *client) 10000, 250000); if (err) { dev_err(&client->dev, "Error waiting for input clock or PLL lock\n"); - goto cleanup; + goto free_clk_names; } /* clear sticky alarm bits from initialization */ err = regmap_write(data->regmap, SI5341_STATUS_STICKY, 0); if (err) { dev_err(&client->dev, "unable to clear sticky status\n"); - goto cleanup; + goto free_clk_names; } err = sysfs_create_files(&client->dev.kobj, si5341_attributes); - if (err) { + if (err) dev_err(&client->dev, "unable to create sysfs files\n"); - goto cleanup; - } free_clk_names: /* Free the names, clk framework makes copies */ -- 2.34.1