Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp563996pxv; Thu, 24 Jun 2021 14:23:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR4pJCBBfWOCJVluu1/OjP2VVt+4Cgge1E18bDHWAH0RFU3yJj0BXIfqL39N9ecDK0EK4b X-Received: by 2002:a05:6402:c03:: with SMTP id co3mr10084066edb.21.1624569808702; Thu, 24 Jun 2021 14:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624569808; cv=none; d=google.com; s=arc-20160816; b=Z4tuEfMphUQC+o0xeJhYb9hdT24jgMFbSliuOA4s9+m7W6Kf8Z2QVDZIB4pp2nYYs+ rvH84WQtjOoAV6iDM7F7G01KTYgixcafjec1KhKm4ex749SvcGrj/r3r+DqDywvhHTj6 tCPdG1vDi+7pFCYAEZxJA6hAbZfPq0d9CycGjB+B1NSaOxy/xRFG8LB0umwBOtoFEPDX dhXCkOJmcDwkpTwt67NgmWruZRl60+GMWynBEC44vNed99+SqVB6DysnX95E3kgMT8WK MvwSeoQBWEHiqTpiD3V3tVlIph8UeHhW5h8EHQmBxOx1AC6MTeajnrQNpqBkqKS+zb9Y wrGg== 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=ci4PnGCxJGlbkiF75YQ2OspYZpnpl3ipp2RVAIX0P0E=; b=t26r0Shx0ff/tbEWCTkm6MrQodvo+rWU7x3MTpPPpJai4uuhy6HF3BnrxQ5PQTdGPt Z1LD+zLxKu5FfYcCY0UO2kxTit2He6gNRw5//vue/L/fCKQwl8A0Co4hcCPcw0AAI4K3 lnI/oid9nvE2qEczesoHA2A9vob1PF+6agaKBtktSdIcqbuJwlIr++hAAfFt85jHCxgb Zy6rSgcy/x4nlCXooZUf356uhv3UK+Mpg+ElgAhDZAsjO7DvGHCGT4UquAVYHibxgwTP SdPyr5uxbtnaT/dt2oFNCspTpyf/+YoZDwTsdHjh6+jF9MHxbGVsaPK01kMbRM1Knezw +LHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iLKW7DKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 26si4189097ejk.617.2021.06.24.14.23.05; Thu, 24 Jun 2021 14:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iLKW7DKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232644AbhFXVYP (ORCPT + 99 others); Thu, 24 Jun 2021 17:24:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:47048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232029AbhFXVYO (ORCPT ); Thu, 24 Jun 2021 17:24:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B9BE26124C; Thu, 24 Jun 2021 21:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624569715; bh=MwO9BW7F8u85dyg2TGOKlZ7UI2TnjRUjqM503pSN/24=; h=From:To:Cc:Subject:Date:From; b=iLKW7DKEl64x9Qf5HTpK0uOhrMreIq66X1U0KB1JW5RidFei/4dBZDlUgPODgLyCv yuAu85JVo+Lj8EvJFKYegTScQaTVnNwDGYjP4V4k8Wj1lgRmQYyliDlU34iucl9TEw 4LhLZi0/lDh4JpKSX6k71QTt+s58rsNj623KCUfhuyvmDGc2auEMfk8DaiDAalEVav Hj3EjnhsmGiFkhhOmnVjgDH2NHtAJxLzaegeZNHuuxXEn1GF4itnXQAksVgnfePILf UiP4LmGXYALrcd6akuhhQWxbd9Fey9WX9f2w5TDC2c88z/1bJo4eDJ0rtGO1+Uas9M ac7xjlOKQ2oxg== From: Nathan Chancellor To: "Geoffrey D. Bennett" , Jaroslav Kysela , Takashi Iwai Cc: Nick Desaulniers , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [PATCH] ALSA: usb-audio: scarlett2: Fix for loop increment in scarlett2_usb_get_config Date: Thu, 24 Jun 2021 14:20:48 -0700 Message-Id: <20210624212048.1356136-1-nathan@kernel.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: sound/usb/mixer_scarlett_gen2.c:1189:32: warning: expression result unused [-Wunused-value] for (i = 0; i < count; i++, (u16 *)buf++) ^ ~~~~~ 1 warning generated. It appears the intention was to cast the void pointer to a u16 pointer so that the data could be iterated through like an array of u16 values. However, the cast happens after the increment because a cast is an rvalue, whereas the post-increment operator only works on lvalues, so the loop does not iterate as expected. Replace the post-increment shorthand with the full expression so the cast can be added in the right place and the look works as expected. Fixes: ac34df733d2d ("ALSA: usb-audio: scarlett2: Update get_config to do endian conversion") Link: https://github.com/ClangBuiltLinux/linux/issues/1408 Signed-off-by: Nathan Chancellor --- sound/usb/mixer_scarlett_gen2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index fcba682cd422..c20c7f1ddc50 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -1186,7 +1186,7 @@ static int scarlett2_usb_get_config( if (err < 0) return err; if (size == 2) - for (i = 0; i < count; i++, (u16 *)buf++) + for (i = 0; i < count; i++, buf = (u16 *)buf + 1) *(u16 *)buf = le16_to_cpu(*(__le16 *)buf); return 0; } base-commit: 5c89c2c7fbfa9124dd521c375b9c82b9ed75bc28 -- 2.32.0.93.g670b81a890