From patchwork Tue Feb 6 15:10:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Wolsieffer X-Patchwork-Id: 197623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1765065dyb; Tue, 6 Feb 2024 11:22:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfbrfTPfF15xD2ZefwV2qjVXQS1tNklhUuvisEy9sbsyUPegsqmuBYMPLBUMEgqoH/ltIP X-Received: by 2002:a05:6a20:e11c:b0:19c:a10c:726b with SMTP id kr28-20020a056a20e11c00b0019ca10c726bmr2912553pzb.21.1707247345729; Tue, 06 Feb 2024 11:22:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707247345; cv=pass; d=google.com; s=arc-20160816; b=Z8smdWsFLyqUk8MJEY1oPxqRp53pnFDu4W7owbs34Q6c0zscOdozvi5c8rCXx2J6yO BfQVuvjdIjdAuBdehbxYGLdaDGaiWt9MD+98vMSZ1eVaLxgbN9kEZ2kwJz3w/qV2pBvS dKp+dTX0AA9/edw90wrIcrWF20Dzvn8RWy/TU+4OVtIP/Ngr33vDwnpsKCcdMBbRYa3F WO/4wkbGInUD1yT2a6t0aNvUCJ+kobWPNOsuEW+6e+Bk0DOnox+9515zm0NBHEXkJhG5 5onfMqXhzWi28Kqbu/n2ssGFDYGiTm7OtYL8ghPmihAa1q/KDArxuKoVB0k41YLJpFZk hMyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=sYfFNAiageIfuh4cpngMOun9DVS7g39fafIbd6OpWGY=; fh=w2ZPHZZOkNr3/P513lkCroQQSYGXV98I+sxa6/qqmAQ=; b=lPWHf6x+YyzQQchpvqbKX52EJTj7zb0bmOOZvrTJfCbvVKqhYs2Iy1Ty5zvgHJL5qR 84PLVIvSBwbL/HWyodNgmJ5MIAOktK6aVjertPS5oMc0kCLiSEDU9Z0ozBUwHCfiLtVY cOYOSdlJu9hn2FguNWE9JW4U0IeoxPLM0kxvvbLMRQfYlCBQM++vykYMcjjkhj15QRYy Mkr+6+rRCjtqTstSLBHOCug+6web9Ax6V7g0xBOTj2sxkQRbDvkVrrzqkE5Tw6GkbvpA BM1emJ2RDe6qJUk96xkmhtd4Q2fdPWTNXS7OhLHPgkN5tXVqP87BX0qT/Iu6k7JQEaXn adLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=P4ty6tuF; arc=pass (i=1 dkim=pass dkdomain=hefring-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-55197-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55197-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWDlzVoVTRseEIhLVF7iIrKtcDq1gmCk0f17UPVeIX7KVBlgHvUepLlOeYF704m8WUUNqO2noXitUxiZBOmIOk2J6EZhA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h8-20020a63c008000000b005cecbe69c23si2173036pgg.43.2024.02.06.11.22.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 11:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55197-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@hefring-com.20230601.gappssmtp.com header.s=20230601 header.b=P4ty6tuF; arc=pass (i=1 dkim=pass dkdomain=hefring-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-55197-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55197-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 13010B315CB for ; Tue, 6 Feb 2024 15:15:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2ABA137C29; Tue, 6 Feb 2024 15:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hefring-com.20230601.gappssmtp.com header.i=@hefring-com.20230601.gappssmtp.com header.b="P4ty6tuF" Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11DA2134CFB for ; Tue, 6 Feb 2024 15:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707232258; cv=none; b=uhQTgpr9f/EnaYxew4wMUJ8i9chqwsp4v8ui8Vr8BMChWqxoAjFhifeczHJw/xgrlZ2H6/krJUYRXRO5hbN/3+qbab0V5WjiZl7Pepgp9wnMUzY9hS2TIzZaB1ngnNh9zxTcWMpwz6csdoFugqRq757nRJf6mLrSM+ptsrBqPfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707232258; c=relaxed/simple; bh=osnqFI0ZtxEkvRbQ0EWBH7BL7X2o86yrUG9y9rOwtI0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AKz801q9qD6lQCWaWw8Y8u+JQOHuv4qF7D+/A6pJvfBREJuPRg4IXeepoA9rgADs0uNzpMDsXPQxH7AnaFntEQYOhhMJtE2C4lzZ7grBG+9dJXCsASjh6s+h8GkbViRazs75hDk+Q03ghDICbX1H5HKGf4XCUdL1YL2K9FbuZ/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hefring.com; spf=none smtp.mailfrom=hefring.com; dkim=pass (2048-bit key) header.d=hefring-com.20230601.gappssmtp.com header.i=@hefring-com.20230601.gappssmtp.com header.b=P4ty6tuF; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hefring.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=hefring.com Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-68c4300518bso26197086d6.3 for ; Tue, 06 Feb 2024 07:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hefring-com.20230601.gappssmtp.com; s=20230601; t=1707232254; x=1707837054; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sYfFNAiageIfuh4cpngMOun9DVS7g39fafIbd6OpWGY=; b=P4ty6tuF3lnD/vP2lHwLsaYqiyTrK09sHgAeX9FAbdghmUbaHsi9sybwdouYgPGbDF 93aU3aPWWFi2H5ii56tK36hc4K5y5T1u9uK0jIO/rrkuaRiuwpDGL/M83t7qklOVmBhG h3e+OAOShTVkzGmmmM/ULlUEkCMn278lS583FeQqjTEpeBHk6+fUFfZ+KfLbkf4VqAel s2I0KHSgKb8rx91ekhjQ3HxIPJ5m8kEmEHDqn2Rk/kYegR6BielkF8XuF7Wj3Pw61bjb jLIIVNuyHkkLq3jJqpjDJEh47lXS07qjslnyq8mMfs1D227eHW+S40N8KGIJcRE52ZsY c1Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707232254; x=1707837054; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sYfFNAiageIfuh4cpngMOun9DVS7g39fafIbd6OpWGY=; b=Oa3GR1GQ0Wwg2KWTjc8lkxQhUwse7oZy9NMJxTuk1zUo/7Y9e6QwZNHLWCFu6J73h2 EPrb8CUUK1Xgfjl2t7tz05T6WToAPgO3hN8t4XHfN1Qr2mZthQIm8DWpPiNIuJbr4yzK r56uH7FNP4j5AprbcxI2fToFyg8n6/iPHUUDs4E3a8OVOzJlHkeADg8gTc+QHc7tUj4x PJJmkApHJkhsr5qnx31qEExDce00Jsip2O8tKJobTBcLFFwPXMhU6VrSHKfZ17OjUCon 9T1ZvFD+tRl2eC9477VUe1FLaP61nQUv1R+58qha8Hc1GbGrX3fiqsUS572XwRdttooD +3ww== X-Gm-Message-State: AOJu0Ywhi00SfpJnQdn/SQGM6z3jLXvKuWNTJUxd4rQKw86Ez6mx/S1D +eKUJU+SCFGprcjTSLL3JSRC1qDApqahN8lNRuO6E1svwzW6IWxTEpnWtjd5cHtej5B5Vk8pX5x 7iPk= X-Received: by 2002:a05:6214:2262:b0:68c:a7f6:12b2 with SMTP id gs2-20020a056214226200b0068ca7f612b2mr3736640qvb.8.1707232254207; Tue, 06 Feb 2024 07:10:54 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWpxvvPlLKxDbC6P8YYRRL2v77MAgpJ3Xwr2pa35c4v0MFlgGUgk3Oz70gojR8ZlTNx4Albf4/vEBVcLo7na/+3ha3bx7dJGwlkc7WsgKouh+xYj7riiNc7ndIdv19qyVnvPj1hnOJRyV6B6w9hhgW6hRfQuDNJ0tSIjUqpkh0yXpvujo0DbDl5vOMwQOc= Received: from localhost.localdomain ([50.212.55.90]) by smtp.gmail.com with ESMTPSA id i11-20020ad44bab000000b0068c3a7e4789sm1074190qvw.103.2024.02.06.07.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 07:10:53 -0800 (PST) From: Ben Wolsieffer To: linux-kernel@vger.kernel.org Cc: Mark Brown , Greg Kroah-Hartman , "Rafael J. Wysocki" , Guenter Roeck , Ben Wolsieffer Subject: [PATCH] regmap: kunit: fix raw noinc write test wrapping Date: Tue, 6 Feb 2024 10:10:05 -0500 Message-ID: <20240206151004.1636761-2-ben.wolsieffer@hefring.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790164524006739433 X-GMAIL-MSGID: 1790178592776321354 The raw noinc write test places a known value in the register following the noinc register to verify that it is not disturbed by the noinc write. This test ensures this value is distinct by adding 100 to the second element of the noinc write data. The regmap registers are 16-bit, while the test value is stored in an unsigned int. Therefore, adding 100 may cause the register to wrap while the test value does not, causing the test to fail. This patch fixes this by changing val_test and val_last from unsigned int to u16. Signed-off-by: Ben Wolsieffer Reported-by: Guenter Roeck Closes: https://lore.kernel.org/linux-kernel/745d3a11-15bc-48b6-84c8-c8761c943bed@roeck-us.net/T/ --- drivers/base/regmap/regmap-kunit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c index 026bdcb45127..4eb18f5d3265 100644 --- a/drivers/base/regmap/regmap-kunit.c +++ b/drivers/base/regmap/regmap-kunit.c @@ -1202,7 +1202,8 @@ static void raw_noinc_write(struct kunit *test) struct regmap *map; struct regmap_config config; struct regmap_ram_data *data; - unsigned int val, val_test, val_last; + unsigned int val; + u16 val_test, val_last; u16 val_array[BLOCK_TEST_SIZE]; config = raw_regmap_config;