From patchwork Mon Oct 24 11:28:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445006wru; Mon, 24 Oct 2022 06:11:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EjZSvR613xTADNr1iIjpNH10RnV9RorQUlN5Ri/UCDx0Ix6KaPmZXJJzXoRFh6fa8l4Al X-Received: by 2002:a17:902:f687:b0:185:4163:3368 with SMTP id l7-20020a170902f68700b0018541633368mr34022113plg.25.1666617119177; Mon, 24 Oct 2022 06:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617119; cv=none; d=google.com; s=arc-20160816; b=0N56qH8UJzJ7t7lsaV+lBgYR1DHAX019rt1u9o7ddF5qLUa/jrCxFRqJZs/xvooOGH l4RxM2wKf0Jo6UdIlFK2Kbj39yiXPr3CjuvzvHhB+HBBB0xW29UIvhs32Ux4dW7qAey2 pdaITWkY4dLUqw7nKJzrU8vbngLnYb3GqNNOznoNmFUM0CQwwwyyPhwpIcSCEAkOTNtJ RlFUuSSbXsnedwkeHvjaPerXQsRQV43rEdoA7zO+xJ2TFSu84ULhVrbtkDP/pMrFZZj1 mkbMmaz4s9k7v2bkfk5d9KDecpE8gn1EAlB+VQ9QHJQ8r4kHD+760RCtZCR6jdTIJtQ0 bloA== 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=VNm8nY1hBhOtYIrZQ71g/ZpjzM3UCUkFcSGjOD/ehXA=; b=Mk4xECvUTv/kmKO4ryHp+U0FWKOFOezDYkfqCmfq9S1y8bPNntCc/HHnYNLSPYws2x RLdemHHxNMXAfuAWusO8OS3ZZszEQ31pXnew85hKBYnB0FFvld8vydsUI7A7R6IAcO40 1VNwA3QrVrbxQ+2QRbXKJPQq0HXuN6EPbzZcaljSnSaJD3roYmeHa/FHgYhlnflGkZ+t c0p8W+xtd0SNJRybyk9dCBfHQn49XuPwgH252oEMdRQAJa8ncY1MRDODfqAyDiXtO3E2 1g2YVCzg9Nx412HPogeI/g8O7YnmW5hNUdlv6QZ58iolEGg6I1LRJ2+25+UDXERb3YU5 PeSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBdSz84r; 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 h12-20020a170902f70c00b001782a6fbc7csi33598375plo.463.2022.10.24.06.11.45; Mon, 24 Oct 2022 06:11: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=SBdSz84r; 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 S232100AbiJXNLa (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbiJXNI7 (ORCPT ); Mon, 24 Oct 2022 09:08:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78CD9F346; Mon, 24 Oct 2022 05:22:06 -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 9C33361281; Mon, 24 Oct 2022 12:19:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B35FBC433D6; Mon, 24 Oct 2022 12:19:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613998; bh=+uBp4s5k9w8OaQPz9fOORY0Wxie4lKxtfkqZIUFQYQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBdSz84r2PuOpPm5nrsWPAyWo7UJvpl1l1KHpRe5jbV3opKrv+5XoBbV9jLVll2ne UVixWpKrAA+f2/GlBWBBZbtF8vqqpzMt3ipJaMAdRLnk1NTUL+7amdm7WrHmd9kkf+ 1iOvIboklVsttToggmr943kYt2tsEYdex0JExQDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.10 094/390] MIPS: SGI-IP27: Free some unused memory Date: Mon, 24 Oct 2022 13:28:11 +0200 Message-Id: <20221024113026.645371712@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747574712353316448?= X-GMAIL-MSGID: =?utf-8?q?1747574712353316448?= From: Christophe JAILLET [ Upstream commit 33d7085682b4aa212ebfadbc21da81dfefaaac16 ] platform_device_add_data() duplicates the memory it is passed. So we can free some memory to save a few bytes that would remain unused otherwise. Signed-off-by: Christophe JAILLET Signed-off-by: Thomas Bogendoerfer Stable-dep-of: 11bec9cba4de ("MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()") Signed-off-by: Sasha Levin --- arch/mips/sgi-ip27/ip27-xtalk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index 000ede156bdc..e762886d1dda 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c @@ -53,6 +53,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) } platform_device_add_resources(pdev, &w1_res, 1); platform_device_add_data(pdev, wd, sizeof(*wd)); + /* platform_device_add_data() duplicates the data */ + kfree(wd); platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); @@ -83,6 +85,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io_offset = offset; platform_device_add_data(pdev, bd, sizeof(*bd)); + /* platform_device_add_data() duplicates the data */ + kfree(bd); platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return;