From patchwork Thu May 2 07:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 794102 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp111490wrr; Thu, 2 May 2024 00:42:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVmrXZ3Hu5etdJEvnDMnXx3Dmrsm0VokZeeJxv6/7sk5fX5xXf15MvlE5n7FBbsVNYM6fKl5T0mk1jflZ28UO9y X-Google-Smtp-Source: AGHT+IHtJhVFGQxRmUq5w2NcAPtzje/ir2aJVcqCU3QnHLN/XZwbJVRpj5/h954cLPfJLSCWnQeE X-Received: by 2002:a05:620a:4050:b0:790:f18d:a4e4 with SMTP id i16-20020a05620a405000b00790f18da4e4mr6102258qko.58.1714635769023; Thu, 02 May 2024 00:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714635768; cv=none; d=google.com; s=arc-20160816; b=CfsRCuVm2FQSMGI9v95YGW9QjmBxQaqjQLq72urC+gJ9rrZxQmjVF1X5MXYkv43e2T 0JCQ+gi5BHfOiqM6QESWaazYOUqOo2ols3IzmWHrwoNL2fU7AYxDrO7GAYjOCje1AFqy 5uDJd4LJDnv3T9qfn5ja+M09Ex4MVhLCGrnxwkKEqsLv58YJcLUKlTUbKMfRy1Vgu2Ae VzldZN8iD+DCbW5EibOqAh3mgBuhMQ7Iv1H1F28Gbz+eshHiiipwv6vPgH6/9iiJBm20 yH1fmp+Zppcqt8y1m9qDhYlm9f6o8omO4AVS3Jn6Zi242tYPvSzVV2TEHhbJEZ5ezdLq sLEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=uJqQFQLxnDneJQpNwePbjyQtotXX3ciG0fz6r7EnZkI=; fh=Uq4CCH4qgIScoA1ZlzK6h1LD8Rw6xac8JtYTs6G5zlc=; b=IoEDzEH05ykwLVa/p/hj+ZBU+C5Mp51iHBuFr8XYkg7mwKvx4WrVBjvWZz4Dq1W/Cq PwUMfOTAcW78Sw5jWrVjygR0ESr/6/X4OhCxjXaYVKpVZCDo3D1RAV/Reab2ZoVGtzZ/ xZE8Qh5/qVzRmzBJiw94E2cESqVpo9t+rMLdFKb0Qv4fsoPhxEXtavGjoNmxHW5OaugJ 6yp+PkF4XC/iOCoVTYhbkVHKX1LWdCTdrfLIHypw2G1wUcpcQ12DQOMlOC2PSPpr4EU2 SSRJ80aMiwIIWcjmbQF+rEhp/hPysqcOwCTIxljsqdrhgtIdNYdgdRsK+iplB3pXbOZC VwVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BOeuon0K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs15-20020a05620a470f00b0078f1507cb8esi401333qkb.53.2024.05.02.00.42.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2024 00:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BOeuon0K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2R4x-0008Di-Ic; Thu, 02 May 2024 03:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2R4v-0008D1-JE for qemu-devel@nongnu.org; Thu, 02 May 2024 03:42:05 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2R4t-0000Ir-Gr for qemu-devel@nongnu.org; Thu, 02 May 2024 03:42:05 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-34de61b7ca4so700823f8f.2 for ; Thu, 02 May 2024 00:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714635721; x=1715240521; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uJqQFQLxnDneJQpNwePbjyQtotXX3ciG0fz6r7EnZkI=; b=BOeuon0KpcB/2NusDzgya7gRV36zYV8NiblZBvjvArI7CMzfCvoepBpcIHF15kiBCu lXAhyuyeYozCFedk8ikU8haNaQeMB6okb8a3R5Cb5wIft0Ue+Yl+Ss/mfe8TLOw8MSYH TplMSurF5D5X2nGJwpEjA//Hp7gFwIVAtEcCTenZgmwatZf8N6dXQIXVMy5KNuYcBFxH AT56i0rdKq3pFS2rF6z2GIr0+DnUVzmqNDfNfs2XSzO/Ba4Gyl5Sfat/MLqhWuCciQfU nY+1nkWWkAsQKAf327GWqX/xHz9o+CfDVPUrxxeJTf728kxTgzQu2Ld3BIv4UEXg7/+D kK6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714635721; x=1715240521; 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=uJqQFQLxnDneJQpNwePbjyQtotXX3ciG0fz6r7EnZkI=; b=WWndejR7aHJ8k3UKpXkuTB7siFoLEJ6+rjEGVFKwi6SqvII2PzTigEu0KP3ObjzwjB xgQsPeLiDS/udPgGBK2Vi0CPbbZ32pWrQguLX0nuM9pjOsv1mt0JP7e0k3cUKX97bifJ 1GT4ag/04hVWw3IKfdX4WFBxeNkwj7DhW+OiY78VKk34HXm8Hobbfw236tzR6VT+HLDv A0NV8LC966BnjUfKYWZxH64Mu7HR35602dRuoW0FCsg5ZtTPojXYI/4UNSzlUBmTalHJ tKfC8KWU9O9E5gh+MK24MHwFxmEpBKr09utZWWxRgOISupoJopy9HwPKQOTVXr/RrWaC bQJQ== X-Gm-Message-State: AOJu0YxGKfBYC/ldedMyFBTDXs09Ad/eJCmw63rqg5ucB2hR7HiaWL3l GKUF/Yk7yINCBXT9B014NWC42ATGdttiRThwwxvhr0/Fo6YSbDc+ngBRhsB955kT7zyQo6pM+9X Q X-Received: by 2002:a5d:6ac4:0:b0:34c:fa17:f4fe with SMTP id u4-20020a5d6ac4000000b0034cfa17f4femr1168832wrw.21.1714635721145; Thu, 02 May 2024 00:42:01 -0700 (PDT) Received: from m1x-phil.lan ([176.187.215.106]) by smtp.gmail.com with ESMTPSA id v23-20020a5d5917000000b00346ceb9e060sm556455wrd.103.2024.05.02.00.41.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 02 May 2024 00:42:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/input/tsc2005: Fix -Wchar-subscripts warning in tsc2005_txrx() Date: Thu, 2 May 2024 09:41:58 +0200 Message-ID: <20240502074158.85800-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Check the function index is not negative and use an unsigned variable to avoid the following warning with GCC 13.2.0: [666/5358] Compiling C object libcommon.fa.p/hw_input_tsc2005.c.o hw/input/tsc2005.c: In function 'tsc2005_timer_tick': hw/input/tsc2005.c:416:26: warning: array subscript has type 'char' [-Wchar-subscripts] 416 | s->dav |= mode_regs[s->function]; | ~^~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé --- hw/input/tsc2005.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c index 941f163d36..fa93eb5d25 100644 --- a/hw/input/tsc2005.c +++ b/hw/input/tsc2005.c @@ -406,6 +406,7 @@ uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len) static void tsc2005_timer_tick(void *opaque) { TSC2005State *s = opaque; + unsigned func_idx; /* Timer ticked -- a set of conversions has been finished. */ @@ -413,7 +414,9 @@ static void tsc2005_timer_tick(void *opaque) return; s->busy = false; - s->dav |= mode_regs[s->function]; + assert(s->function >= 0); + func_idx = s->function; + s->dav |= mode_regs[func_idx]; s->function = -1; tsc2005_pin_update(s); }