From patchwork Fri Apr 14 15:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 83492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp474359vqo; Fri, 14 Apr 2023 08:40:33 -0700 (PDT) X-Google-Smtp-Source: AKy350bRRqSg6Q0w+8wmfO+b90dNlP1x8crKiAOTVAphg4hPU31bFzqKHl1gRNOD2ITjdOTiOsGt X-Received: by 2002:a17:902:ebc5:b0:1a6:8405:f709 with SMTP id p5-20020a170902ebc500b001a68405f709mr3280021plg.20.1681486832857; Fri, 14 Apr 2023 08:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681486832; cv=none; d=google.com; s=arc-20160816; b=DQYNmPJq3F5nqR4oc/+ewjVaiHcXxB2AkthCTEdQda5NL7UuD/d6zkaJtKOocnN/i8 Rq83g0xACf6ngAzZK16xqTs5UD7ICHKWv+DeseoZyVPwVuagVdid+/jRlEgIeZ97jsTm a1ollCG60xO9nkLzNxUixw/mViGz06M1lbyyU3YlLe9PJmqG4o/6bKAzmb2OzUvVwXnw jLXZfygxVG0jD8AxPj7FIuejHGFCvuoImhLSxVgbi6nfXR8cgTgA9wOBMc3Ad0awY3uH aGEx6Qe/lBNFbZboW+CauL2VaCboN2+rX1tXBEVdekz+QryqZstsegYmPnFmZ0dXgwR8 MBNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K1cH0ZtWLCX8sI+lF/y9e1IRq9QfXxo07nEhVezuoz8=; b=Cac2lFcWW6r2vWdILaTKoIe9sZAca+Ru3ybiSHOlELgr/ByYfQlayZYIJ8nCQxCKYb 5P7h34ajPaJgH4kJgXwrKZbCXVuw1g86SlO5m2s0HCj72dbv1WA4rKzj0MDFiLBj9T8l 22ncizLJos5y9+5c1dUIeg057u+rxYlikHPI4iF8m691K4bGfTuHS+bl2WTx3a8gnd2s VqftNlEXiv5hkkDChlPlGsxCBa5QqqBwhcUDpVlqprSmwbjnJ+R1qeiiUYzPWcGTAvOd t0A7wouHa5OF0lQuTpVa5HjKHIMnQMEiEk1qwNMIyGgt65P6ytjdN5x0ru8QwZhdmjgD fxxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=KwdFeteY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a170902c94400b001a076305275si5090628pla.318.2023.04.14.08.40.11; Fri, 14 Apr 2023 08:40:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=KwdFeteY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbjDNP1f (ORCPT + 99 others); Fri, 14 Apr 2023 11:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjDNP1K (ORCPT ); Fri, 14 Apr 2023 11:27:10 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F0910255 for ; Fri, 14 Apr 2023 08:26:37 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33E7k6Wk003961; Fri, 14 Apr 2023 10:26:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=K1cH0ZtWLCX8sI+lF/y9e1IRq9QfXxo07nEhVezuoz8=; b=KwdFeteYV3LvVQ4LwHXsqQ6/9A/ryuBJIE/ur0hLpjJfMliaxImDpIFPP+O/q8MDmiqF +kap4nqKA0GMNqbNqI0GsOUYOJay8DXhjJlReMg9BZXvby46xZLTr/lZkB/9sTSilknk mctQ6JUORS8RxXF++tQu/lxSPo/mc1XCf29o+6WQnAXdxQr6WTLm94AfUELMUEIC1a7e MTpEXcqUc1CZ2hiIvYPJ8ETTvftATAi4JO7kmPpPCb2jmGfDXJeYslO8kGOuUUTeuCBc KKZGr5YSNi+GgmK7ktyxQtr1cpyLjcIQWjKBsxASPXwJ+QGwQbbXYCwU4Yy/KeOXdJO4 iQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3pxm3qa2sv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Apr 2023 10:26:01 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) 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.26; Fri, 14 Apr 2023 10:25:59 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 14 Apr 2023 10:25:59 -0500 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.135]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 8ED9545D; Fri, 14 Apr 2023 15:25:59 +0000 (UTC) From: Stefan Binding To: Mark Brown , Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v1 2/4] ALSA: hda: cs35l41: Fix endian conversions Date: Fri, 14 Apr 2023 16:25:50 +0100 Message-ID: <20230414152552.574502-3-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230414152552.574502-1-sbinding@opensource.cirrus.com> References: <20230414152552.574502-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 5jipqptVmrcXanMYxa1yYbmgYy1HOgdG X-Proofpoint-GUID: 5jipqptVmrcXanMYxa1yYbmgYy1HOgdG X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763166737296688902?= X-GMAIL-MSGID: =?utf-8?q?1763166737296688902?= Found during static analysis, ensure variables are correct types before endian conversion. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index d100189e15b83..b02462ae21f04 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -308,8 +308,8 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, } #if IS_ENABLED(CONFIG_EFI) -static int cs35l41_apply_calibration(struct cs35l41_hda *cs35l41, unsigned int ambient, - unsigned int r0, unsigned int status, unsigned int checksum) +static int cs35l41_apply_calibration(struct cs35l41_hda *cs35l41, __be32 ambient, __be32 r0, + __be32 status, __be32 checksum) { int ret; @@ -379,10 +379,10 @@ static int cs35l41_save_calibration(struct cs35l41_hda *cs35l41) /* Calibration can only be applied whilst the DSP is not running */ ret = cs35l41_apply_calibration(cs35l41, - cpu_to_be32(cl->calAmbient), - cpu_to_be32(cl->calR), - cpu_to_be32(cl->calStatus), - cpu_to_be32(cl->calR + 1)); + (__be32)cpu_to_be32(cl->calAmbient), + (__be32)cpu_to_be32(cl->calR), + (__be32)cpu_to_be32(cl->calStatus), + (__be32)cpu_to_be32(cl->calR + 1)); } } vfree(data); @@ -745,7 +745,7 @@ static int cs35l41_runtime_resume(struct device *dev) static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41) { - int halo_sts; + __be32 halo_sts; int ret; ret = cs35l41_init_dsp(cs35l41); @@ -773,7 +773,7 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41) &halo_sts, sizeof(halo_sts)); if (ret) { - dev_err(cs35l41->dev, "Timeout waiting for HALO Core to start. State: %d\n", + dev_err(cs35l41->dev, "Timeout waiting for HALO Core to start. State: %u\n", halo_sts); goto clean_dsp; }