Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4807892iob; Mon, 9 May 2022 02:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0oid+rpvvnfEJb4Xi8Cayvo7PLGABVMqrzevpz1fvU7CphO1ZJt5fuBVl4NvyVx9A5PDC X-Received: by 2002:a17:90b:368e:b0:1d8:fcd2:c6ca with SMTP id mj14-20020a17090b368e00b001d8fcd2c6camr17206961pjb.44.1652086932770; Mon, 09 May 2022 02:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652086932; cv=none; d=google.com; s=arc-20160816; b=dv7j8nEMw1o2IEK3yChydfbEPCR1Okdzh2gMgjMVzyz6LQkXaAYrnaEGTbFVWx4W2k sczjmTqDTTNnuen6i6Brxc7RgR67SsnNG7iJLQg0VyC7DHnYVPvyXZtSe+xEqp3HrdWw AViFHRLWjMCdVr+/1VRYcyuyEndW/7eF5FbqkP8FvT4rbwKhHsbztHjcDG6ElgF62JtU 7exJrdL00X6ZphXOcNAF0ETK1hKSTY+wVmabsstwBGJMJvgJmN0xYYKRhnFDmvtkB1wF 6z0SDPUs+61SmwK6RnaO6nNHUOn6YkcIfTTn0oGkvpv0CVRUQsyHy1cykqxkT6Mhrk0m D8Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:message-id:date:subject:cc:from :dkim-signature; bh=u4HKeG270L/jN8SAhLqpcEmSK8EaW/IJUsz5DJfPsg0=; b=wlLOlSFo9SLoJWGeZIpkTrco61dCnyYPPQHhc5V6KnzFWQmg9Twzs8+SoJ37AaEMva OTTqnAADOPRO6swjKuapH5wlmwUTHCw5Dsu7s6s9zSKnDWmupGFYmaPuPeLga47KzbI1 XPRBOKweFMtY3yI4QVDOSkjX07QXZMEHciPmHJ7NsRpB6Awn0M/QIXtyLz6m9R24UQdL syAGTkoLCCwyUFd0eQRXg8Vcz3js1HZY2LZrtqiExwwFqql0XrVu9s4msj51gRXFl04V p4DAjOn6OPHNtZgK6FElX2FPUulfuqU7ZcwljtdTw6fngXFMi1VEld+IhBzDqJYEB3oR YWCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=cxDO6SEx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p15-20020a17090a0e4f00b001d978640c3fsi13358177pja.159.2022.05.09.02.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=cxDO6SEx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D72FF1B793C; Mon, 9 May 2022 01:49:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388332AbiEFCci (ORCPT + 99 others); Thu, 5 May 2022 22:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356352AbiEFCcg (ORCPT ); Thu, 5 May 2022 22:32:36 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C01F460D9D for ; Thu, 5 May 2022 19:28:54 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id bo5so5139878pfb.4 for ; Thu, 05 May 2022 19:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=u4HKeG270L/jN8SAhLqpcEmSK8EaW/IJUsz5DJfPsg0=; b=cxDO6SExYy63yup4qE0H2Xls1X/edJo7KS92SiyLaiaJXY1zwBMO4XlaiBSe5iHQJF WsV43Qyz3O3gukoVvtmVc0a47kdC+naHUFtIS47yA12ifIjhvZjc3CAsghampYABTGhW N3svjaqQ8nMgp7GWK1scGH+o1YBMYPZWv190b/lWheFEmD8iqtmsSGTVzJjFzdj+lzAi Ou4QJ8rSkWUe42M7V+dvY9e0DHbFE/9opY6iHK7lnqOEbN2zwwokHaTFZbXkAqdvzIcg GhqedwYI9R/79hoZ9Th9eVsVzB8VJHNHO5EKQQBM+Ltq/ABwJdc+f+PGFje7V2FDqBp2 ObwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u4HKeG270L/jN8SAhLqpcEmSK8EaW/IJUsz5DJfPsg0=; b=UnBNrfWyq4E2no+CUkUs/zddDFBN4hoyotn5alsiu4mFz7/iA0Kvakgy+/cQTeHkTd c47vegQpLTvodSg84Vu10Z4HyeS4bQpV6Y0gEZqjz08ZuGmqORpjyItiLRKrfkYTJ5eU ymYwGpQdcnZ/YnKJnt9TI8sHF1ghWidTKn89ks3vX/7UlWO7nqP07QcKPDX6qASUdMRC Xm/pq19PWuv9FSP1oQUGt98x5B+zaO39hG20eAPlLWIut+ZKkiQuqCyYp/o6I8r44nY8 U5zYR04jIL3raU6nS0foaPyk8k/lgPi71Nmb0OYhKP39v24nxDvcoXO2zZkJMJ85S4pS lXtw== X-Gm-Message-State: AOAM5303g2VrgtOpqe/JdlyfYInNv9E1QLyG2YWyJzuTfI+fITSbJEfR ltcULiPdmMp3Jj8h8wN1+78= X-Received: by 2002:a63:5755:0:b0:3ab:a0ef:9227 with SMTP id h21-20020a635755000000b003aba0ef9227mr928502pgm.541.1651804134270; Thu, 05 May 2022 19:28:54 -0700 (PDT) Received: from localhost.localdomain ([183.14.31.73]) by smtp.gmail.com with ESMTPSA id p43-20020a056a0026eb00b0050dc7628184sm2154856pfw.94.2022.05.05.19.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 19:28:53 -0700 (PDT) From: Puyou Lu Cc: puyou.lu@gmail.com, Andy Shevchenko , Andrew Morton , Kees Cook , Petr Mladek , Linus Walleij , Guenter Roeck , Chris Down , linux-kernel@vger.kernel.org Subject: [PATCH] lib/string_helpers: add allocated strarray to device resource. Date: Fri, 6 May 2022 10:28:43 +0800 Message-Id: <20220506022845.26750-1-puyou.lu@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,SPOOFED_FREEMAIL_NO_RDNS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a must to automatically release strarray when the device disappears. Signed-off-by: Puyou Lu --- lib/string_helpers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 4f877e9551d5..b4497c068172 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -757,6 +757,7 @@ char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n) return ERR_PTR(-ENOMEM); } + devres_add(dev, ptr); return ptr->array; } EXPORT_SYMBOL_GPL(devm_kasprintf_strarray); -- 2.17.1