Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928060rwb; Mon, 15 Aug 2022 14:13:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR6PorJQVetzxbihwJ01g+OOtDOsiParO3paaW3RZcArSifEmWEJYZ7MhMlFYgSDBm8Kj0N+ X-Received: by 2002:a05:6402:d06:b0:440:3e9d:77d with SMTP id eb6-20020a0564020d0600b004403e9d077dmr15303675edb.286.1660598016278; Mon, 15 Aug 2022 14:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598016; cv=none; d=google.com; s=arc-20160816; b=qqsQcB0tEqx30vi01nxIOVhSukNWTgfLHXn4dIoGybO1uMtdDtIriL3tIQw9rOl6SV XEpbpoAW0YUw+kHHiKOmuTobNaaw+szRxPj217UWND7iGpyfVr0DPgaZ95cAH59wSh0C NXMjq2MlMswI0MKMuGIlc7uSi3EfyptgnjJnVWlJ9fhxHPhttvwhuDqW4mF6dKKtLc6f jkt2XiXvDhnZuo1CQVHwJaGEcPc3aTgOASJ0lw8NpaZkTablcqLJdCjCpubCIM+4gIG3 bh24SCPzQ1dJy7ANK60s7jRVV+FhqtqC62BLRdDcZKD9oIUbTMauCzC5usHXTXN7BOAS rITg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aH2bpR7wO0/Y2uqeAQAccXV1KX9NUJL+9qMEJTTyjRo=; b=vq/Oc+x/lE+nBc0fOw82qQF4Tt21A8YCIFxOrbaA7OT/vnAu6xE6w7qfck8OYlvFic KqHRCBlybprGnkSnEILlXxVg+18KQFVsXRD67yjTnNjChzUTMyLRMXTjmyO8a1J1AlSN 1gtfMn9LUO+00+0iQcuuiC5/cS3RDlo4inQqTp8lt/gNMDKvCsG48hEgzcm0gFXQVrq4 uVgoX68Zs1lHSSutr1AbJpIhcSyJL/jLWtaSlkh+kgx2DCHBZ/KicKmRGeqqnipCXHVi 74Ed58fLQ0pyTzfwTU96N4bMLSosZEoGwK8Jbh97aCKJnZAMi1+vrnrsh5wv333CPMpp blVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fQweulcl; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a1709061e9400b00730c1868d6bsi7661867ejj.90.2022.08.15.14.13.10; Mon, 15 Aug 2022 14:13:36 -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=@linuxfoundation.org header.s=korg header.b=fQweulcl; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347484AbiHOUZu (ORCPT + 99 others); Mon, 15 Aug 2022 16:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243999AbiHOUSo (ORCPT ); Mon, 15 Aug 2022 16:18:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7DE145F43; Mon, 15 Aug 2022 12:00:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5B56B810C5; Mon, 15 Aug 2022 19:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A3E9C433D6; Mon, 15 Aug 2022 19:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590031; bh=CBb0Nq4prmkpogVj+AXr6e4xJHBujYPfz49hr0sMgxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQweulclZqzj9c9h3EUo78X+qrr6vsFVAxhMY1ERm/lp3+XC0RlfszWzS8b6vK4Oi PUOVNLZcs1u2y7ieqNiYdujJqPjGK25oqZk8tw4H83jGxtL6BT8iZXtBWumVLQWmlc 3mpC7S9HKWPv51sSgxCxi4wuIWDIDJ6Od9gUmDG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Vinod Koul Subject: [PATCH 5.18 0098/1095] soundwire: qcom: Check device status before reading devid Date: Mon, 15 Aug 2022 19:51:37 +0200 Message-Id: <20220815180433.612111006@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Srinivas Kandagatla commit aa1262ca66957183ea1fb32a067e145b995f3744 upstream. As per hardware datasheet its recommended that we check the device status before reading devid assigned by auto-enumeration. Without this patch we see SoundWire devices with invalid enumeration addresses on the bus. Cc: stable@vger.kernel.org Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220706095644.5852-1-srinivas.kandagatla@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/soundwire/qcom.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -471,6 +471,10 @@ static int qcom_swrm_enumerate(struct sd char *buf1 = (char *)&val1, *buf2 = (char *)&val2; for (i = 1; i <= SDW_MAX_DEVICES; i++) { + /* do not continue if the status is Not Present */ + if (!ctrl->status[i]) + continue; + /*SCP_Devid5 - Devid 4*/ ctrl->reg_read(ctrl, SWRM_ENUMERATOR_SLAVE_DEV_ID_1(i), &val1);