Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2279457rdf; Mon, 6 Nov 2023 09:26:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/MDyvP4fjXwY2FMwpE2d4510BYHNR4+MUt9zvu6O719n7LAVPmL9OY/REQYKWWV7yBruS X-Received: by 2002:a05:6358:7f02:b0:16b:6ea4:d1c5 with SMTP id p2-20020a0563587f0200b0016b6ea4d1c5mr2270393rwn.27.1699291596605; Mon, 06 Nov 2023 09:26:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699291596; cv=none; d=google.com; s=arc-20160816; b=FU8KQ1z/xUdjzRrnpv74aE8oGlPiPLFZASxCi6hSToaOnfSAPLgxUHpecv4g1GwsTm nDGDa2Ms8E80ODKyChXSMGg8Ch/oCS9hzCOH/tf+l5BksCoqvG/ZKw1L3sGDfEHusz1P yBDbZfZZKq67akn2etWAR0eZS40PyyTwI8YjSW/d5laTbUR6oL0H72QpUvrj96evBjED JRDgUMegBpaRkxGQ3SUlaZpa4ddGo+3am+2bcAsJ3MJUuNnZ9ni4xUwewiq6She2GrPT geFqfBkUWA6BbwQWRG2xKnsXaNORW4ia/F0GOcTIL1v/Fi0ejGz5t7dCM3exT4Bxks3O XTPQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=WcST5ABue6IsnqHZV3oTaKyNlMPnd8YrlPpC3JsEA1s=; fh=E36W0jRcn4Xv/TvoRfuyZ2higkySCLB3RjP8MwuYhCQ=; b=sezCm2M7rWrCtUh1Da1nQIZkAgpFzy2mPtExZcPVwFp9xhCbnqA2o/ZbYbHibngTOP BQ6Gj+QSvuDvpGWmbhz7cG/9ctZAkw9tgc4eyWZZ2o0xF4Kr58A9tfuaL3cZBP0ztjtI FOjTmMFO9GCs/V41rBXaELDT3VXZF8bClByDFPxmwGk0f5i6VZihWKUleZF/WmbDWQqJ Qx6iCghY9Meqwgk9uEje8oOSXTF6XOLIaDnfMfFkvS1HezeZXQe4U+pzVDTn/+wdnsUN 9c7RMFuv0wZD7/Aj3+4pxvIvlwJPausIYZ9Ym0690MO1qEg5wsLh0sf5aT67d8C970sa n8Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=fppnJUVe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o10-20020a63e34a000000b00578b37ad24bsi97021pgj.619.2023.11.06.09.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 09:26:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=fppnJUVe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1E5A780BD529; Mon, 6 Nov 2023 09:26:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229485AbjKFR0T (ORCPT + 99 others); Mon, 6 Nov 2023 12:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232891AbjKFR0S (ORCPT ); Mon, 6 Nov 2023 12:26:18 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A679D4C; Mon, 6 Nov 2023 09:26:15 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3A6BpQjA023965; Mon, 6 Nov 2023 11:26:01 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=W cST5ABue6IsnqHZV3oTaKyNlMPnd8YrlPpC3JsEA1s=; b=fppnJUVeNOZreU1ns nZmlYmeX8N4Sywn/qpHEHAkjLiY7OHuM6gZ/BqrhFf46ms/Zh8LHdWSJvK0TUs/9 o/lYWjVh0wTQIMzBHkM1VwBWPbaI+cu/K7pdRydqNpXjGH+RsKsfP1LwffccX8DD R+pbmSBqxIUS3oSO70zZTQIYmzbq4lRJACDWPR1XZsBCBNCZ8uizajtA6WNKoZwh GpSmcj4oyrZIlDlkGTEE9UsmFaFKuBL9SxvDVLEOS3DJndlnvr1+VcEDuCwHLbXl cpA7/hDQ9i3rrWETrLOyWvX9JBxLnbVfGRwfzmVYpmeLBKYxiRP3pDGS5h5Qbe8A Ji2pw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3u5jcj25x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Nov 2023 11:26:01 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Mon, 6 Nov 2023 17:26:00 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.39 via Frontend Transport; Mon, 6 Nov 2023 17:26:00 +0000 Received: from EDIN4L06LR3.ad.cirrus.com (EDIN4L06LR3.ad.cirrus.com [198.61.64.48]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id B9A76B38; Mon, 6 Nov 2023 17:25:59 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , , "Richard Fitzgerald" , kernel test robot Subject: [PATCH v2] kunit: test: Avoid cast warning when adding kfree() as an action Date: Mon, 6 Nov 2023 17:25:57 +0000 Message-ID: <20231106172557.2963-1-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: qCaErWCKZ_38yqtY9gdJk2PPOYzLMSZk X-Proofpoint-ORIG-GUID: qCaErWCKZ_38yqtY9gdJk2PPOYzLMSZk X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 06 Nov 2023 09:26:34 -0800 (PST) In kunit_log_test() pass the kfree_wrapper() function to kunit_add_action() instead of directly passing kfree(). This prevents a cast warning: lib/kunit/kunit-test.c:565:25: warning: cast from 'void (*)(const void *)' to 'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function type [-Wcast-function-type-strict] 564 full_log = string_stream_get_string(test->log); > 565 kunit_add_action(test, (kunit_action_t *)kfree, full_log); Signed-off-by: Richard Fitzgerald Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202311070041.kWVYx7YP-lkp@intel.com/ Fixes: 05e2006ce493 ("kunit: Use string_stream for test log") --- lib/kunit/kunit-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index 99d2a3a528e1..de2113a58fa0 100644 --- a/lib/kunit/kunit-test.c +++ b/lib/kunit/kunit-test.c @@ -562,7 +562,7 @@ static void kunit_log_test(struct kunit *test) KUNIT_EXPECT_TRUE(test, test->log->append_newlines); full_log = string_stream_get_string(test->log); - kunit_add_action(test, (kunit_action_t *)kfree, full_log); + kunit_add_action(test, kfree_wrapper, full_log); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, strstr(full_log, "put this in log.")); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, -- 2.30.2