From patchwork Tue Apr 20 14:50:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1468366 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-secospa-onmicrosoft-com header.b=A5nCl5Yw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FPmqb5fYVz9vFD for ; Wed, 21 Apr 2021 00:52:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B574D82B44; Tue, 20 Apr 2021 16:51:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.b="A5nCl5Yw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84CFB82B31; Tue, 20 Apr 2021 16:51:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::604]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C297482B23 for ; Tue, 20 Apr 2021 16:51:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9gMeUTddrKWQdeSn6jqLakQuxhTtuMytnbij6n3Pdnj1SNDD1T7xs1bYEwMe0/C1p50VKaJxcrEmbupixZU3mKTWHNhM51jXwkzlK8HPPAJ988Yth1Jo4XdEIPTOHjdFRSZEIMAP0zWFaeo3eTHaSYvc18tdXxRdnCYcH1dNAEJR6bM3psCdENtleCw9DJ8gxY3KhgF/yOwfHoIl/MFUzHf6TRFrVLDPPHlSiUzT7pZiyh9H/dV7J4QSgasRo7vpkQHJBZgJ2slYDfmskHv+eYvh+SZAdZWse8r8NfybJ49HUKqhEjdn7OA7Ydzgu/dK56kBeyedfJ51f7WKd3h1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qsej+4nyM3KkL0JpfcxvURvduOpbQ2lFhdH3wVvztCI=; b=QV6UXclamVib0TNpa+Amr8hpX2BG9NgCaWOezCha0AtOg9TeyQ+Z6F1Cqb2zioNdP+tMEq7PMdhFVUVgOHTOCml0ne+hEjHO89HxV+BtlK4WaH6BTkCgCMs4d+1MCQzfRaBheFUq3IHVXZyGQ3J2QtKfOVchJMOLaUkZEVooGEl8ONzBSWtotnTacjfsxI/oguYzaZwR7XK0eSjeYXbnu3x2jQxuW3DmIo8xNfGOCXaUu2vxq+N8CoTmNJ+yxg3tXrG2gb7qgc2N5Ieeh9hhUs9WBrGvNJnpWNDICxrThbC1BF9NJi+VTHXReXMWwSv1Zi/M8O91yc8zrjpT879qMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qsej+4nyM3KkL0JpfcxvURvduOpbQ2lFhdH3wVvztCI=; b=A5nCl5YwtQkAYXpagWFbHwlzyCV+vHGYJHRJlcBlpVZpyXrsSoSJCQHCutmWoqhpBt1Hz+oNB538T1hD8RkTGN65IBOeMZqIK6ljhbR43t3TKApByx4gctNdzypuJQdPblQq5/n6+dkNl3BR3ThDEkfXabBTICp2GcoCaDgOkFc= Authentication-Results: konsulko.com; dkim=none (message not signed) header.d=none;konsulko.com; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB9PR03MB7243.eurprd03.prod.outlook.com (2603:10a6:10:220::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Tue, 20 Apr 2021 14:51:19 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::9181:c45f:b367:9bdc]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::9181:c45f:b367:9bdc%5]) with mapi id 15.20.4065.020; Tue, 20 Apr 2021 14:51:19 +0000 From: Sean Anderson To: Tom Rini , u-boot@lists.denx.de Cc: Simon Glass , Sean Anderson , Alexandru Gagniuc , Bin Meng , Marek Vasut , Michal Simek , Philippe Reynes Subject: [PATCH v4 3/5] sysinfo: Require that sysinfo_detect be called before other methods Date: Tue, 20 Apr 2021 10:50:56 -0400 Message-Id: <20210420145058.3934010-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420145058.3934010-1-sean.anderson@seco.com> References: <20210420145058.3934010-1-sean.anderson@seco.com> X-Originating-IP: [50.195.82.171] X-ClientProxiedBy: BL1PR13CA0424.namprd13.prod.outlook.com (2603:10b6:208:2c3::9) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from plantagenet.inhand.com (50.195.82.171) by BL1PR13CA0424.namprd13.prod.outlook.com (2603:10b6:208:2c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.8 via Frontend Transport; Tue, 20 Apr 2021 14:51:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0e6d4f0-ce91-4fd3-ae6d-08d9040bc1ff X-MS-TrafficTypeDiagnostic: DB9PR03MB7243: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R4zJ3W9NGUeo4D2/XbPKgqHtCKbiqPYPQ3TjZLEpYsLTjo97dgnZSaTRS+iUbFl7pHWRqOA20NL0mbnW/Gnzbd/i7wVCViO62ZY04X/vomB/5RpKSOnpCHo9lQflLNl3WqVFbJy63tHxqc2bmNcpdKSZaIm2kXmpumwthMyRN2H3FtCCxbSbbnupepFi3cU+WG/QyFhRiWzfmX1W7OpbcRDbSCULLL9glwLYShsNV/6+ZJRG7fFQ9bWwQTEVnRJmxEfyJBXSbQllLXd1+EhjQoyZhYhJSWBgUpk3jY+6wcMgFB5QkXQ0w9Goa6V55MiPyf4eNsYZGWD5EEk+aER3Obb2e3ub+Tbjjv4eGddwwnfg2vtptJSqrY6oYvWLEiofF82uZtZRbMTMFGPyR4aqFQiGVqhKRapLElhhfA14rw9S1/gqHiGmYj1mlY/bRmlc6cc922vTtO+zr0rChGIEThuA7QKkDd+vB84KiglwvP0zz6hA0yXLtKSHd5g34B+ZY70jKimV5S0XWyZYJVsA+h3CXvk0m2soYqhfEdllkaReYdUwsRxrmiCRy/Gk7m0Sw/6CU6DYadB0AruadI4arKwINIj7mV5mNN6lagyyW6EW0LsmWCG2tsjDHObEE8jW3SynKbyrkGjG5S2X/9uf2WSYn0VZJYicT/o8SesLziw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(16526019)(44832011)(498600001)(8936002)(1076003)(2906002)(186003)(6486002)(86362001)(66946007)(38350700002)(66556008)(4326008)(6666004)(38100700002)(8676002)(6512007)(6506007)(66476007)(26005)(956004)(54906003)(83380400001)(5660300002)(2616005)(52116002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: X+HELJWMUKSsKTEeqt5c0MTfrTXz1DmqrN7JsHJBCfU4qRvh9lBk85Dcqcq2xNcYjKU1tZf3cOThYqVgTqHuVTmPwO9J4Ihc9BSfhpEVH2bhqOVrd7D3JQnSaSdz0M2vCH/mex4grXifJ4j0jIuaM2e5jubEf2ycrcvVcyFyVKEE98qJxo3GEtNpH4LLrZllVdb3SzGdNTdT/uh2QKjDpZxcy/1t0YM927CWxgI7s+jEDQ6IuMsO67I2Jgsvuk+k7BleSLpBk9GYe0NxKB4GXhoPJaugSUt1NsxnOUvdCO3HyHU9TF3EhYyKnZFKK/G2ofS9yVb8xvC3edUJ7t/8Z7qZMgpCLS+/c5nlxTPrcvA65otmvhIQMawineHbKE8ADll/0rK7p1SJcdSWU6wRGX84ZjnEFm6qTq3soxRQNbUBsVOkb4nGZGq8pibK2NI5BORiWi2SyjekCiJDiNAjF/22saGBPzsp/7gsOai3bDtPCdTcHsWVDXi4paB+lWuqAnZXcQuGrFd85yVI1QHdKgvjHriUo5+g2mflBsMaJiyMjuE999+e844nEi8aXpAXonjvWt7ZP+7w9TgF3Lr02WDqbyPJ47+yz0fuqgud+bVrbX96N8i++w8IAlRN6dcOWKxaaCR8iWHFaDfjJIcIkTDrqgRSv7/N3pDBU0fsu7KFc0/E8ThocYPhf5J9mCX2LBBcEndtVKk3SwN1KSwznpT7Aj29L5qvZ2/BTGUAkCEkjKglDS/ZmtE/R1QffhhkE0sjSL+3fWfgrCP0xI7RmlLra2zHpTYoCuX3a0RCV9Sg8pVebWZj9PGbyGnnBr3esxjueoTMfGflMeX4Odof8GpCKJU1n8kYRdm/vQttfGXft+GvNcXVLpI2mPdfyRCNNcxe70NRF2xD6xAaH9SvDM22VRkgy7z9T9hR3Ui3DsdUnNiKAnP1f1aeM2M4aN7IhiK4fnjYb47d3ozT8lobO7ruwjNfBT6s6QaiKKVOU6zFGC9UpaHLn5rOUAPHkXNu3n0raZbk3o5C5Bq2nVwH7cX0UrFpWEIc9uEs6qaEQd7JQgO+XmufMrlUvo9j2sauEGutf4khH+Dz1CEyBwi7+wtFMXaNizUEms416O3bUnxBan96D+/0cKxef2CQq6ouDWl2nPR+vFKXYuABK7crh38/t1CWvhahwfO38I8h7KEAX7sJvgUg/nw9ZQmZrA3tsXCiam/nt4ISAUJwy2qCQiz/WtgzE03/sPigUkXc0YSXOhoX2ZVrgxANLu+YSXAZpttq3e1EAqgPe08vl7Xoq1aRj5Obe90qRZQjyn4HefBJ6uWRWxEaH+bUAhXpbCEw X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0e6d4f0-ce91-4fd3-ae6d-08d9040bc1ff X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2021 14:51:19.6745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mOkC1U/hIvboknjvxF34deFk/zZQO73bTWQsmbsxDPxVlfUOjBX5coUvx5NkV6uoldIzAvY71DvyChPwrUzeAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB7243 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This has the uclass enforce calling detect() before other methods. This allows drivers to cache information in detect() and perform (cheaper) retrieval in the other accessors. This also modifies the only instance where this sequencing was not followed. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- Changes in v4: - Fix test failure caused by uninitialized variable Changes in v3: - Move detected bool into sysinfo_priv struct Changes in v2: - Enforce sysinfo detect ordering in uclass. Users must still call sysinfo_detect beforehand. - Modify sysinfo test to check for detect() ordering. common/spl/spl_fit.c | 4 ++++ drivers/sysinfo/sysinfo-uclass.c | 29 ++++++++++++++++++++++++++++- include/sysinfo.h | 26 +++++++++++++++++--------- test/dm/sysinfo.c | 25 +++++++++++++++---------- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 4288f571fc..caddf51196 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -110,6 +110,10 @@ static int spl_fit_get_image_name(const struct spl_fit_info *ctx, * no string in the property for this index. Check if the * sysinfo-level code can supply one. */ + rc = sysinfo_detect(sysinfo); + if (rc) + return rc; + rc = sysinfo_get_fit_loadable(sysinfo, index - i - 1, type, &str); if (rc && rc != -ENOENT) diff --git a/drivers/sysinfo/sysinfo-uclass.c b/drivers/sysinfo/sysinfo-uclass.c index 6df58fe160..4a660dfd15 100644 --- a/drivers/sysinfo/sysinfo-uclass.c +++ b/drivers/sysinfo/sysinfo-uclass.c @@ -8,6 +8,10 @@ #include #include +struct sysinfo_priv { + bool detected; +}; + int sysinfo_get(struct udevice **devp) { return uclass_first_device_err(UCLASS_SYSINFO, devp); @@ -15,19 +19,29 @@ int sysinfo_get(struct udevice **devp) int sysinfo_detect(struct udevice *dev) { + int ret; + struct sysinfo_priv *priv = dev_get_uclass_priv(dev); struct sysinfo_ops *ops = sysinfo_get_ops(dev); if (!ops->detect) return -ENOSYS; - return ops->detect(dev); + ret = ops->detect(dev); + if (!ret) + priv->detected = true; + + return ret; } int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type, const char **strp) { + struct sysinfo_priv *priv = dev_get_uclass_priv(dev); struct sysinfo_ops *ops = sysinfo_get_ops(dev); + if (!priv->detected) + return -EPERM; + if (!ops->get_fit_loadable) return -ENOSYS; @@ -36,8 +50,12 @@ int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type, int sysinfo_get_bool(struct udevice *dev, int id, bool *val) { + struct sysinfo_priv *priv = dev_get_uclass_priv(dev); struct sysinfo_ops *ops = sysinfo_get_ops(dev); + if (!priv->detected) + return -EPERM; + if (!ops->get_bool) return -ENOSYS; @@ -46,8 +64,12 @@ int sysinfo_get_bool(struct udevice *dev, int id, bool *val) int sysinfo_get_int(struct udevice *dev, int id, int *val) { + struct sysinfo_priv *priv = dev_get_uclass_priv(dev); struct sysinfo_ops *ops = sysinfo_get_ops(dev); + if (!priv->detected) + return -EPERM; + if (!ops->get_int) return -ENOSYS; @@ -56,8 +78,12 @@ int sysinfo_get_int(struct udevice *dev, int id, int *val) int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val) { + struct sysinfo_priv *priv = dev_get_uclass_priv(dev); struct sysinfo_ops *ops = sysinfo_get_ops(dev); + if (!priv->detected) + return -EPERM; + if (!ops->get_str) return -ENOSYS; @@ -68,4 +94,5 @@ UCLASS_DRIVER(sysinfo) = { .id = UCLASS_SYSINFO, .name = "sysinfo", .post_bind = dm_scan_fdt_dev, + .per_device_auto = sizeof(bool), }; diff --git a/include/sysinfo.h b/include/sysinfo.h index 8054d4d4a1..b140d742e9 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -60,7 +60,8 @@ struct sysinfo_ops { * This operation might take a long time (e.g. read from EEPROM, * check the presence of a device on a bus etc.), hence this is not * done in the probe() method, but later during operation in this - * dedicated method. + * dedicated method. This method will be called before any other + * methods. * * Return: 0 if OK, -ve on error. */ @@ -104,7 +105,7 @@ struct sysinfo_ops { * get_fit_loadable - Get the name of an image to load from FIT * This function can be used to provide the image names based on runtime * detection. A classic use-case would when DTBOs are used to describe - * additionnal daughter cards. + * additional daughter cards. * * @dev: The sysinfo instance to gather the data. * @index: Index of the image. Starts at 0 and gets incremented @@ -127,6 +128,9 @@ struct sysinfo_ops { * * @dev: The device containing the information * + * This function must be called before any other accessor function for this + * device. + * * Return: 0 if OK, -ve on error. */ int sysinfo_detect(struct udevice *dev); @@ -138,7 +142,8 @@ int sysinfo_detect(struct udevice *dev); * @id: A unique identifier for the bool value to be read. * @val: Pointer to a buffer that receives the value read. * - * Return: 0 if OK, -ve on error. + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. */ int sysinfo_get_bool(struct udevice *dev, int id, bool *val); @@ -149,7 +154,8 @@ int sysinfo_get_bool(struct udevice *dev, int id, bool *val); * @id: A unique identifier for the int value to be read. * @val: Pointer to a buffer that receives the value read. * - * Return: 0 if OK, -ve on error. + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. */ int sysinfo_get_int(struct udevice *dev, int id, int *val); @@ -161,7 +167,8 @@ int sysinfo_get_int(struct udevice *dev, int id, int *val); * @size: The size of the buffer to receive the string data. * @val: Pointer to a buffer that receives the value read. * - * Return: 0 if OK, -ve on error. + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. */ int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val); @@ -173,7 +180,8 @@ int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val); * function that returns the unique device. This is especially useful for use * in sysinfo files. * - * Return: 0 if OK, -ve on error. + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. */ int sysinfo_get(struct udevice **devp); @@ -181,7 +189,7 @@ int sysinfo_get(struct udevice **devp); * sysinfo_get_fit_loadable - Get the name of an image to load from FIT * This function can be used to provide the image names based on runtime * detection. A classic use-case would when DTBOs are used to describe - * additionnal daughter cards. + * additional daughter cards. * * @dev: The sysinfo instance to gather the data. * @index: Index of the image. Starts at 0 and gets incremented @@ -190,8 +198,8 @@ int sysinfo_get(struct udevice **devp); * @strp: A pointer to string. Untouched if the function fails * * - * Return: 0 if OK, -ENOENT if no loadable is available else -ve on - * error. + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), -ENOENT if no + * loadable is available else -ve on error. */ int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type, const char **strp); diff --git a/test/dm/sysinfo.c b/test/dm/sysinfo.c index 4aaa9e85bc..96b3a8ebab 100644 --- a/test/dm/sysinfo.c +++ b/test/dm/sysinfo.c @@ -17,40 +17,45 @@ static int dm_test_sysinfo(struct unit_test_state *uts) { struct udevice *sysinfo; - bool called_detect; + bool called_detect = false; char str[64]; int i; ut_assertok(sysinfo_get(&sysinfo)); ut_assert(sysinfo); - sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect); + ut_asserteq(-EPERM, sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, + &called_detect)); ut_assert(!called_detect); sysinfo_detect(sysinfo); - sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect); + ut_assertok(sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, + &called_detect)); ut_assert(called_detect); - sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str); + ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), + str)); ut_assertok(strcmp(str, "R'lyeh")); - sysinfo_get_int(sysinfo, INT_TEST1, &i); + ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i)); ut_asserteq(0, i); - sysinfo_get_int(sysinfo, INT_TEST2, &i); + ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i)); ut_asserteq(100, i); - sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str); + ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), + str)); ut_assertok(strcmp(str, "Carcosa")); - sysinfo_get_int(sysinfo, INT_TEST1, &i); + ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i)); ut_asserteq(1, i); - sysinfo_get_int(sysinfo, INT_TEST2, &i); + ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i)); ut_asserteq(99, i); - sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str); + ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), + str)); ut_assertok(strcmp(str, "Yuggoth")); return 0;