Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4699528rwb; Mon, 31 Jul 2023 10:44:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbkPx3ZPoKo1gtNWLOomWQgZB1O3Z8D6wxC6rA6P75WlAObK6V4qDwHpCxKzHEQeX28BCl X-Received: by 2002:a17:906:8a70:b0:994:54fd:31aa with SMTP id hy16-20020a1709068a7000b0099454fd31aamr409671ejc.15.1690825455240; Mon, 31 Jul 2023 10:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690825455; cv=none; d=google.com; s=arc-20160816; b=HDmYkt/W6BjNZ0OlonDJ+JRqYSQvP5MG6SIDZe3cNLG0eFhPtEh26Ruq6t53vI6V2q DugJpCznwele6ghcmHVQQ5gQxzGPBwf+6tbj3e59gmQg+0glRQvv6CzUYITJ6QR+6kbL MxcUTugPq1D/HvxbfBNMRTp68EWAjstZG+ftUkAzu+uhtNPPq67CLqU27GXGGHENEPXT uNijWTei+tk3V1crDD1+7WFFt0J1Fq9shRTTYrB3JAK+645subS91w3x6cZWnaoE+7uG /pZ1zEJk8pq62Q1Nq2kXeeBdS0Hw1VZAsgbfg0ab6qZjelVXIszBEh3CJDuLGFS2uQPQ vwNA== 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=RHyGoQzk1u5genvtgwGtlQ8eSjyHd0Gs4TL3IEXqR+A=; fh=++3DPgNRpClAYl/wOqcu6GdLXzb+wGOgYMictO4+73w=; b=OUlWEdjvo7f7WG2ybI50wPl3PPoXYVCZTTIW6ZfgG4tpLqhuJPlyA8J9crEuCH8svx MZ5vkXD97Hc6mH65NykNFHZKrotVCn0L42H8w8pxTRefJbALUjDOJ2xTDmqzivvdXN7Y SY/D0fCM4fLGZDbGobXvUUlxH0mgtf9n3Bg1H5sNs6V+J7MQM7wbFgFf8QnfdZrPHMuf Bwsl+pW1eQpcyrzKqjV5mp/FEIyYehENOMf7UY9StNNru+72fKxIzj0iB+tO0T2Ws7HA Kps9nQ9gVQxhXegO5yrKlUt4DCTAtWuuMAaWRpJfZ5fVjLBtNNAq+QQyOd0tMFtbrRcf ywrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=U5vUnEnl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gw22-20020a170906f15600b0099b53d41849si3591117ejb.506.2023.07.31.10.43.50; Mon, 31 Jul 2023 10:44:15 -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=U5vUnEnl; 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 S230147AbjGaQ7A (ORCPT + 99 others); Mon, 31 Jul 2023 12:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbjGaQ6X (ORCPT ); Mon, 31 Jul 2023 12:58:23 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF881BCE for ; Mon, 31 Jul 2023 09:57:57 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36V5lNJQ017071; Mon, 31 Jul 2023 11:57:38 -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=RHyGoQzk1u5genvtgwGtlQ8eSjyHd0Gs4TL3IEXqR+A=; b= U5vUnEnlzFelQxYvCphDPRU+MpWHHJHBUlJdiIZ2pV5SukOR1kJsHs7jFzettXd0 JSXzGjb69lZ1F4B8ry1mCQjUVDa1kOTJNYR/avSjGwbziEXkPxa3+Z8SHgJigucC WcMzCVjkINQ6bEYErJXVGoFgNLiNSfr4t2eUA5bC5meCxps3tXPGp7zjp0uAWhjX AdNvcJMxNu8UPe/cn7fKI9RAsywS0RNKIybfyytIq4xUFi5xtpkDYaCIilf7fKVj i8xknsPGQUF2p4CxxAsk9JRzTQHERSGvcJ72CqAV59TX3y682EPBqbYNL4/gKPPJ pZEHXXu/49KRpbEgZKvfWg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3s5gk1sg45-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Jul 2023 11:57:38 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) 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.30; Mon, 31 Jul 2023 17:57:33 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.30 via Frontend Transport; Mon, 31 Jul 2023 17:57:33 +0100 Received: from EDIN4L06LR3.ad.cirrus.com (EDIN4L06LR3.ad.cirrus.com [198.61.64.107]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 07796475; Mon, 31 Jul 2023 16:57:32 +0000 (UTC) From: Richard Fitzgerald To: CC: , , , , Richard Fitzgerald Subject: [PATCH 9/9] ALSA: hda/cs35l56: Reject I2C alias addresses Date: Mon, 31 Jul 2023 17:57:26 +0100 Message-ID: <20230731165726.7940-10-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230731165726.7940-1-rf@opensource.cirrus.com> References: <20230731165726.7940-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: aR0Fv-GAtzh-w4nrEOUP9pw2wCSgsztH X-Proofpoint-ORIG-GUID: aR0Fv-GAtzh-w4nrEOUP9pw2wCSgsztH 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 The ACPI nodes for CS35L56 can contain an extra I2CSerialBusV2 that is not a real device, it is an alias address. This alias address will not be in the cirrus,dev-index array, so reject any instantions with a device address not found in the array. Signed-off-by: Richard Fitzgerald --- sound/pci/hda/cs35l56_hda.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c index 004740509dbd..76b9c685560b 100644 --- a/sound/pci/hda/cs35l56_hda.c +++ b/sound/pci/hda/cs35l56_hda.c @@ -852,8 +852,12 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id) break; } } + /* + * It's not an error for the ID to be missing: for I2C there can be + * an alias address that is not a real device. So reject silently. + */ if (cs35l56->index == -1) { - dev_err(cs35l56->base.dev, "No index found in %s\n", property); + dev_dbg(cs35l56->base.dev, "No index found in %s\n", property); ret = -ENODEV; goto err; } @@ -891,7 +895,8 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id) return 0; err: - dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret); + if (ret != -ENODEV) + dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret); return ret; } @@ -904,10 +909,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id) dev_set_drvdata(cs35l56->base.dev, cs35l56); ret = cs35l56_hda_read_acpi(cs35l56, id); - if (ret) { - dev_err_probe(cs35l56->base.dev, ret, "Platform not supported\n"); + if (ret) goto err; - } cs35l56->amp_name = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "AMP%d", cs35l56->index + 1); -- 2.30.2