Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216664/?format=api
{ "id": 2216664, "url": "http://patchwork.ozlabs.org/api/patches/2216664/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ide/patch/20260327025043.7565-1-rosenp@gmail.com/", "project": { "id": 13, "url": "http://patchwork.ozlabs.org/api/projects/13/?format=api", "name": "Linux IDE development", "link_name": "linux-ide", "list_id": "linux-ide.vger.kernel.org", "list_email": "linux-ide@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260327025043.7565-1-rosenp@gmail.com>", "list_archive_url": null, "date": "2026-03-27T02:50:43", "name": "ata: libahci_platform: remove kcalloc", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "2fe50633eb80b184a8a1eb562dbd1cdea3a597d8", "submitter": { "id": 70304, "url": "http://patchwork.ozlabs.org/api/people/70304/?format=api", "name": "Rosen Penev", "email": "rosenp@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ide/patch/20260327025043.7565-1-rosenp@gmail.com/mbox/", "series": [ { "id": 497681, "url": "http://patchwork.ozlabs.org/api/series/497681/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ide/list/?series=497681", "date": "2026-03-27T02:50:43", "name": "ata: libahci_platform: remove kcalloc", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497681/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216664/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216664/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-ide+bounces-5354-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ide@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=I7GaevoJ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ide+bounces-5354-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"I7GaevoJ\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.216.43", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhlf25JCPz1yFp\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 13:56:26 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 61243300578B\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 02:51:05 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5BE2B3770B;\n\tFri, 27 Mar 2026 02:51:03 +0000 (UTC)", "from mail-pj1-f43.google.com (mail-pj1-f43.google.com\n [209.85.216.43])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 230DB25EFBB\n\tfor <linux-ide@vger.kernel.org>; Fri, 27 Mar 2026 02:51:01 +0000 (UTC)", "by mail-pj1-f43.google.com with SMTP id\n 98e67ed59e1d1-35a09e0dd63so1584475a91.3\n for <linux-ide@vger.kernel.org>; Thu, 26 Mar 2026 19:51:01 -0700 (PDT)", "from ryzen ([2601:644:8000:5b5d::8bd])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b0bc8c6895sm54574445ad.64.2026.03.26.19.50.59\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 19:51:00 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774579863; cv=none;\n b=LzONtyRjgafd0PJfeR+8T1fL94vVuYRz1MDCEQNGQRaSxLehgrJXRdGYRByNSJJcUFVZCZCOZmHIP7akAxF7YLhlyl1hRX2d21WHlEjydlYWLV0bDXgzWDq2TEOHTz/M92Gf/D9CGRX9ywK5Q2xGEyLyPSHY7gemfGt5WCm8HBg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774579863; c=relaxed/simple;\n\tbh=PhK1uiwCqLIJI3ueMcn4+tjHbQ8klTqD3ZDxXIovspU=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=Os9W7K3URYNdXO0G9ugMYW+st6ddCtjRN7Ld2N/QIWbzXrvr5KoISEjX7GBGhfoB/Y3lWtgomNs9+k2mWtJJhxGDk1jb5Cok9MeQ7T794ncKI4uP/IIGp6UGqvZQ3pEKZdJAuMpBwa8iwKUraTiBb2jO6CgOsC7iMTsBfKJlIV4=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=I7GaevoJ; arc=none smtp.client-ip=209.85.216.43", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774579861; x=1775184661;\n darn=vger.kernel.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=SX5+VodhRV2hJI3/ddIJ/j9D3gWCV2wOSdzAThk9yJY=;\n b=I7GaevoJG7rZ1bxnX7qR8Kui4uSmkux6ryLsLZD6hq8B+GX0TnA0pc05IfFFHjs/q9\n zMd6m91ZmyrYv8ei9Erd3A4zT5ySD41DqlyBuwvA6LcojbUJUnXW7hdlQea3zDAPbW7W\n s00F1sNmOQNHHUkOTVI6+whocKZX4WgPs317Z12W5DR/0VBMkciNrBhIQmIRP3aIsr01\n GsCCbfOjk8WKn5egO3aF+zqV7wqo7i7yHhLEYV+Sn6xyjgaT/P6CZpHCxEQdD8X/ZBWI\n MUmXYlkuGO77gawLVV3ibONKFc9oebyhe5X6bwkbKeyIoibLVsI2s71g7MdvLeed24CE\n LcSA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774579861; x=1775184661;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=SX5+VodhRV2hJI3/ddIJ/j9D3gWCV2wOSdzAThk9yJY=;\n b=MD2pJQey8Az3EnBJYh6Iju+7WBWbY/cf3lZLNJ33R6JBJ4H18WXoub7J+kijtwyEB8\n e1GziHlCELpQOZNBrMw+FbqGM8Imlg446G7M8al2L5MOXUJgbc3jwWr2xkuwqBvmEkmZ\n pBnHbnBlW+PPAFX+OTDH+6GHtoU41sLCvRrmKVvnLkYhe6B8rRUm8tGaqV917jWL0ZFv\n 9zFGFdiNPI3651JybOqojL2gn/HTpGIQAOncfd9ap0xOl05hYh+xHDpn6Gm8HJo/t/sX\n hYFSRz/KBFAJap2PvY7WtVTTfMOY/oTenDl6Qwdgpxmjr/Dlj8nc/htCKpv1K+PXGReA\n BOBA==", "X-Gm-Message-State": "AOJu0YwZUyWyew7yWIS/fb/xROSErUATv2zWW+g/YS91LitU4Uuj9nKu\n\tlfl1lGEOlpgiqV7GI3TQpEEEEYcsKKSJ6hzYqwusIh2G/TO4kWwaih18RlJdYe21", "X-Gm-Gg": "ATEYQzwGjdl3xrRU2cBXYX7jZaFrBHpun9hVbpw8K8zNAdufKVar8/M3kfznXTGwP8T\n\tDIuxr8U8kLVyhQsnJnJgVDqhikkkgKfnCijI+Lffa8aZc02puDyAmHu45JWJ7UaYFuUJToKMaSI\n\tZE5HcMIiUALpXMVyVp6rYotjr5fdzTbnxUmFYCQv2aH5tEqT2DZAlpMhB2kugz+ptz6pUm2x3rt\n\tSAT07YoJzfzB+iF3YmWnEfNuKPYo4cP8k2nzPcLBkEV5Qr9ZwIv4UK3L5dSQJNTJlPaNoC/KUrY\n\tPnZgl5TnP8KYyvvYpC+vN+xOwtP+Yl2XmCrxe8QSbU++4HnhwuzY2arJoaICnvbW0SZE6Bo0rsg\n\t42XX3DCUUwoVKyAuGZvfT2qdj2Q9HGfZ5Ro2Aam28UCfa1FiYK5BpZ2KlvyAiqbkd5k8iQwXTuo\n\tH92kn28PMPepC/b5/ypehqoAfysst02HodXn7vKX7QNxtjdQ7okqREPas=", "X-Received": "by 2002:a17:903:28f:b0:2b0:67a7:5c4b with SMTP id\n d9443c01a7336-2b0cdcb0791mr9021885ad.28.1774579861001;\n Thu, 26 Mar 2026 19:51:01 -0700 (PDT)", "From": "Rosen Penev <rosenp@gmail.com>", "To": "linux-ide@vger.kernel.org", "Cc": "Damien Le Moal <dlemoal@kernel.org>,\n\tNiklas Cassel <cassel@kernel.org>,\n\tHans de Goede <hansg@kernel.org>,\n\tKees Cook <kees@kernel.org>,\n\t\"Gustavo A. R. Silva\" <gustavoars@kernel.org>,\n\tlinux-kernel@vger.kernel.org (open list),\n\tlinux-hardening@vger.kernel.org (open list:KERNEL HARDENING (not covered by\n other areas):Keyword:\\b__counted_by(_le|_be)?\\b)", "Subject": "[PATCH] ata: libahci_platform: remove kcalloc", "Date": "Thu, 26 Mar 2026 19:50:43 -0700", "Message-ID": "<20260327025043.7565-1-rosenp@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "Precedence": "bulk", "X-Mailing-List": "linux-ide@vger.kernel.org", "List-Id": "<linux-ide.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ide+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ide+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Use a flexible array member with struct_size to combine the allocations.\n\nAdded __counted_by support for extra runtime analysis.\n\nSigned-off-by: Rosen Penev <rosenp@gmail.com>\n---\n drivers/ata/ahci.h | 3 ++-\n drivers/ata/libahci_platform.c | 33 +++++++++++++++------------------\n 2 files changed, 17 insertions(+), 19 deletions(-)", "diff": "diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h\nindex 293b7fb216b5..9e8b6319025c 100644\n--- a/drivers/ata/ahci.h\n+++ b/drivers/ata/ahci.h\n@@ -357,7 +357,6 @@ struct ahci_host_priv {\n \t * If platform uses PHYs. There is a 1:1 relation between the port number and\n \t * the PHY position in this array.\n \t */\n-\tstruct phy\t\t**phys;\n \tunsigned\t\tnports;\t\t/* Number of ports */\n \tvoid\t\t\t*plat_data;\t/* Other platform data */\n \tunsigned int\t\tirq;\t\t/* interrupt line */\n@@ -379,6 +378,8 @@ struct ahci_host_priv {\n \t/* only required for per-port MSI(-X) support */\n \tint\t\t\t(*get_irq_vector)(struct ata_host *host,\n \t\t\t\t\t\t int port);\n+\n+\tstruct phy\t\t*phys[] __counted_by(nports);\n };\n \n /*\ndiff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c\nindex f37247e7a5cb..6e072d681341 100644\n--- a/drivers/ata/libahci_platform.c\n+++ b/drivers/ata/libahci_platform.c\n@@ -482,15 +482,29 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,\n \tstruct ahci_host_priv *hpriv;\n \tu32 mask_port_map = 0;\n \tu32 max_port;\n+\tint nports;\n \n \tif (!devres_open_group(dev, NULL, GFP_KERNEL))\n \t\treturn ERR_PTR(-ENOMEM);\n \n-\thpriv = devres_alloc(ahci_platform_put_resources, sizeof(*hpriv),\n+\t/* find maximum port id for allocating structures */\n+\tmax_port = ahci_platform_find_max_port_id(dev);\n+\t/*\n+\t * Set nports according to maximum port id. Clamp at\n+\t * AHCI_MAX_PORTS, warning message for invalid port id\n+\t * is generated later.\n+\t * When DT has no sub-nodes max_port is 0, nports is 1,\n+\t * in order to be able to use the\n+\t * ahci_platform_[en|dis]able_[phys|regulators] functions.\n+\t */\n+\tnports = min(AHCI_MAX_PORTS, max_port + 1);\n+\thpriv = devres_alloc(ahci_platform_put_resources, struct_size(hpriv, phys, nports),\n \t\t\t GFP_KERNEL);\n \tif (!hpriv)\n \t\tgoto err_out;\n \n+\thpriv->nports = nports;\n+\n \tdevres_add(dev, hpriv);\n \n \t/*\n@@ -573,23 +587,6 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,\n \t\tgoto err_out;\n \t}\n \n-\t/* find maximum port id for allocating structures */\n-\tmax_port = ahci_platform_find_max_port_id(dev);\n-\t/*\n-\t * Set nports according to maximum port id. Clamp at\n-\t * AHCI_MAX_PORTS, warning message for invalid port id\n-\t * is generated later.\n-\t * When DT has no sub-nodes max_port is 0, nports is 1,\n-\t * in order to be able to use the\n-\t * ahci_platform_[en|dis]able_[phys|regulators] functions.\n-\t */\n-\thpriv->nports = min(AHCI_MAX_PORTS, max_port + 1);\n-\n-\thpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL);\n-\tif (!hpriv->phys) {\n-\t\trc = -ENOMEM;\n-\t\tgoto err_out;\n-\t}\n \t/*\n \t * We cannot use devm_ here, since ahci_platform_put_resources() uses\n \t * target_pwrs after devm_ have freed memory\n", "prefixes": [] }