Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp464668ybl; Tue, 28 Jan 2020 06:23:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzNSPZU9fC/O/OjewJIoixnnNhMZoJDt1NWD97xsh6AviwWSRTgBEtk5DpEXbsjQIhVEJQE X-Received: by 2002:a05:6830:18f1:: with SMTP id d17mr14591542otf.303.1580221392561; Tue, 28 Jan 2020 06:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221392; cv=none; d=google.com; s=arc-20160816; b=beiEMTlIo0KOi4LHLmt/SpHOnaZDs9uX5mCHYQYT2ssKOkTssxbTLnUI0ygBg7HfLv DaCqv6ErMU1nykd8qRkRVsndLrJ0cfoiRgcpeJQkPXE/QDHiB4OG+CEqVIZfMQjUIBEp RjJBxrFpaRHtMqWxhCnMAS/Z6ACJfIVH6FlfRMBxQcgYNkaWONTW7CKi4PDBD+QmieAE RjPawU2EEjPjDchVQ/Gqe/yel2S/a1RCFBe8N8AoXJv4s9e19zcQaznqxge+/cQ3khJQ EAy8mMXv2BkyvI+UgYDgv2iViPq+5MyASC2sa0+cF9aU6RIMN/BqjgUX6lHWpHpYh3mY tuvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q2XmrmPMJ9iXg638UfS2PkU/uQkktKuqrzmpHrfkDvg=; b=G5qwMudJIYHPSmoRMB+uytmtmTq1kHgcUrtdr8TG3Njj+1mL3oXaWgwc9rqg0Dacmh r4uaGOobehex2trbcnZsUcU32YDQixAWp1LZDCgi6vRPpXCnkwMaJRQTZoh9lSG/PpdZ LBLhjhp6IMBHMF+HNd+cN6SRVWIljFzVO3XxlnJRKENj3TTRJFDdhKESwkxVRxsLVRTC to4YqM+23d92HmAfsuo9NO6K5tHUJVXiSxzIuplm43YP4FvyabktqSxqo33wMKKHsER2 nTfXmmM5kA++bzje/wxC0UE/7k5lzWIyHQVHkbtiujjIf+lgJu1JMwjV12zvHPp1Ms+y XSdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GTDZfs7o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t142si5232847oih.242.2020.01.28.06.23.00; Tue, 28 Jan 2020 06:23:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GTDZfs7o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731451AbgA1OV6 (ORCPT + 99 others); Tue, 28 Jan 2020 09:21:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:47490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731443AbgA1OV4 (ORCPT ); Tue, 28 Jan 2020 09:21:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6526E2468F; Tue, 28 Jan 2020 14:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221315; bh=P8WDGV55YcmU/Rr49K1XQfZE/h0Lqzq8HkWQheqOrJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GTDZfs7obiLzUL0MoOmHlKVQ2W8298DxB4yvje22Ta+NI+3tFFHaA7jCuYrtUMuul ePAeiHvludkgRZaaDz2xvWwilc/bQt7b+jUq8nfCgVlC2halqoC7EWv7s3W/WR92jb sS5ANM6LrSMNAgO9EsYCz3SK58nzvSbPoblgx47M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Johannes Berg , Takashi Iwai , Sasha Levin Subject: [PATCH 4.9 175/271] ALSA: aoa: onyx: always initialize register read value Date: Tue, 28 Jan 2020 15:05:24 +0100 Message-Id: <20200128135905.583232508@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit f474808acb3c4b30552d9c59b181244e0300d218 ] A lot of places in the driver use onyx_read_register() without checking the return value, and it's been working OK for ~10 years or so, so probably never fails ... Rather than trying to check the return value everywhere, which would be relatively intrusive, at least make sure we don't use an uninitialized value. Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa") Reported-by: Stephen Rothwell Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/aoa/codecs/onyx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index a04edff8b729e..ae50d59fb810f 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c @@ -74,8 +74,10 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value) return 0; } v = i2c_smbus_read_byte_data(onyx->i2c, reg); - if (v < 0) + if (v < 0) { + *value = 0; return -1; + } *value = (u8)v; onyx->cache[ONYX_REG_CONTROL-FIRSTREGISTER] = *value; return 0; -- 2.20.1