From patchwork Mon Oct 9 16:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 150212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2001087vqo; Mon, 9 Oct 2023 09:58:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVsFo3te8K5AhDqxDPbLm39SM7+Yr9ZcdGolMDxy1REisrhXx5KOWfO+krf6qZsiCS/Peq X-Received: by 2002:a17:90b:1643:b0:268:10a3:cea8 with SMTP id il3-20020a17090b164300b0026810a3cea8mr12990391pjb.9.1696870708198; Mon, 09 Oct 2023 09:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696870708; cv=none; d=google.com; s=arc-20160816; b=UelFaN/snuAjbog3pvsyiptpAsfbuzujAmNOFdF4SwNOmglnTX48gt5nytN6zVU6m6 ljGYpjQE1u+GILCIzLn4Vqa09qeXV6sdop2Z8EvJsCBcTTK+F0f4ZZ8UJnazhnYqcTcT eQJv75ZF5y1G6FwUZVJVoU9sTaxb+n7YnAIlDO99J7UojrmQjKPmQunSYMKknNu382tS OsCAyXSepZaz32VWde9+5xRnIyFcIClQ6+ZqqfKgwym0o+O7WVzJzP1ctjv19uf0uYic z8PFzM8nnqTwqkJUtCGJjnEHtf3U9/K786AsmEOQgV0jYMT9SegaPFqTcR27K0aB2fsF 3raA== 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=cBjS1gShjaJkPyX/KQvNob7ffrl0lyd3plKPyysabEY=; fh=nfvfGULRixEUQS47ZFVU1vQGtb0Wy82sG2oSs3tSDLM=; b=hI5hcTcs1l8uWQwHJP8HYLksdU0Ib25brLsrikx6ErYvlSNFkyyYQsS7fFSRAva8Nw yvBtBprlbe+Ls+Fr0mvzOEiUZDNsQjY2ZXTfa8yNV7HCZB3thkaySS+EBSCSdLrraIRh pnxpKo4BGs2rzi4bP3+GViy6//QhpYAaEZzakICfDpdu3Zzq3cnqE7LgYNU6gSJh5IgU 2q0wnpJzT4PjuNxfVNQ40d4A11NHvokhLrey0J8OoL8c/CUArH8F9I+xOjC8leddXCLq Q/V1gbyXgJjm7cpH+aeplSa3HRYK4SiMoXpIOdQiBz1i8xsFqYyZkiWIMEEekrm3lI+n oaZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=KWSsWKwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e6-20020a17090a4a0600b0027901ee93fbsi11331419pjh.156.2023.10.09.09.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=KWSsWKwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 01FC0801B9DB; Mon, 9 Oct 2023 09:58:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377812AbjJIQ6C (ORCPT + 18 others); Mon, 9 Oct 2023 12:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377354AbjJIQ5y (ORCPT ); Mon, 9 Oct 2023 12:57:54 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CAD1AF for ; Mon, 9 Oct 2023 09:57:53 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32003aae100so3545740f8f.0 for ; Mon, 09 Oct 2023 09:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1696870672; x=1697475472; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cBjS1gShjaJkPyX/KQvNob7ffrl0lyd3plKPyysabEY=; b=KWSsWKwFhuZjxNlw57LlhSLmB000RjfrYKSEWyZFpizdKupo89jsTs+1Pn1dj3r6VN l0/CuLolEgtuG1LnUrIBr/Cvel6LQ06QQ2qUJwqJVbJRGpoIZjC2CFJ9GQhFI5fSa8R0 PTsfZkHvwt67JoQH9OZ+eR2bFjP8gTipg35fkJovfSCM8+X2i9lchx9ap1wyJmPZO4d9 YMIoftOEy8yY9XyiQxE8QWjsj3pGWzpjLwQffhfxyEXPr4Wu/Rv1lQrRGFvqX4PHdspl zWAJLo+oYMNn6tIlJ75Vfui+IDeDZZWuD/kpkd5wqeGAWCCicZf4BUfBH0thUKTfwETq SI6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696870672; x=1697475472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cBjS1gShjaJkPyX/KQvNob7ffrl0lyd3plKPyysabEY=; b=hEUbXJNM1iL6Y6x9i4vuU4Tq+i3fvixr+lSnH1we1t7HU9CHqfvRDZUKoxXRQFpora UEsUlaKCn0/ArIgUOotOm5s7Mpys/Q186hgHqYLU0DIrkCFS6k6KxcPI8dbfdupG+qBo 6EpWqW9q8FAa99TyKlQkBI3MFQSuGg+342YCGG0Q5jY+Iu+D/evhdKh8QZdc+2EGXKXE 26WKVrU6ddikcpwdUIldM/WG8jQ9zLF5nttfLDijI2RotYvVBETQlc+anqVSAAfAKVaz PzGXWZ9AMXwx3PU1Jj0jTTBcq+JkHOX+DGIdO8n1ud7k6JkAsS6srJShgLsLJZn6m+si C6oA== X-Gm-Message-State: AOJu0YwaEmrISc0oDs4tn9jEyo3HBqG/1/PH9lQJ6b7mFs1j9OVD352f Zju/mkDx/q9AJ4cYiS7eEzxBeQ== X-Received: by 2002:a5d:6b11:0:b0:323:1d0a:5562 with SMTP id v17-20020a5d6b11000000b003231d0a5562mr9559403wrw.6.1696870672140; Mon, 09 Oct 2023 09:57:52 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f49a600529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f49:a600:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id d9-20020adff2c9000000b00324887a13f7sm10199828wrp.0.2023.10.09.09.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:57:51 -0700 (PDT) From: Max Kellermann To: MyungJoo Ham , Chanwoo Choi Cc: Max Kellermann , linux-kernel@vger.kernel.org Subject: [PATCH 3/7] drivers/extcon: add local variable for newly allocated attribute_group** Date: Mon, 9 Oct 2023 18:57:36 +0200 Message-Id: <20231009165741.746184-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009165741.746184-1-max.kellermann@ionos.com> References: <20231009165741.746184-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 09:58:21 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779297899608649069 X-GMAIL-MSGID: 1779297899608649069 This allows the compiler to keep the pointer in a register and prepares for making the struct field "const". Signed-off-by: Max Kellermann --- drivers/extcon/extcon.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 6f7a60d2ed91..e879690d4fef 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1202,6 +1202,7 @@ static int extcon_alloc_muex(struct extcon_dev *edev) */ static int extcon_alloc_groups(struct extcon_dev *edev) { + const struct attribute_group **groups; int index; if (!edev) @@ -1210,20 +1211,20 @@ static int extcon_alloc_groups(struct extcon_dev *edev) if (!edev->max_supported) return 0; - edev->extcon_dev_type.groups = kcalloc(edev->max_supported + 2, - sizeof(*edev->extcon_dev_type.groups), + edev->extcon_dev_type.groups = groups = kcalloc(edev->max_supported + 2, + sizeof(*groups), GFP_KERNEL); - if (!edev->extcon_dev_type.groups) + if (!groups) return -ENOMEM; edev->extcon_dev_type.name = dev_name(&edev->dev); edev->extcon_dev_type.release = dummy_sysfs_dev_release; for (index = 0; index < edev->max_supported; index++) - edev->extcon_dev_type.groups[index] = &edev->cables[index].attr_g; + groups[index] = &edev->cables[index].attr_g; if (edev->mutually_exclusive) - edev->extcon_dev_type.groups[index] = &edev->attr_g_muex; + groups[index] = &edev->attr_g_muex; edev->dev.type = &edev->extcon_dev_type;