Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp217150pxx; Wed, 28 Oct 2020 03:07:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9rR3zdvU+sCuyu9ix0UqdxjbmgcibueSUeNwt7uoWO9/NydZM3ziq60iYhpG5vgrKtgpa X-Received: by 2002:a17:906:1fda:: with SMTP id e26mr6393224ejt.528.1603879651779; Wed, 28 Oct 2020 03:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603879651; cv=none; d=google.com; s=arc-20160816; b=Q37au/cTdS3pHBuBBPhUg3EsecXxkEQyXKppooOu8deIESTl/NQJP9hCEQ49Yi8P6z XyJu5eSz2zoLyn6LVlFvJCyo1WuNvN0OCZfEGguCnwSwU+re5o1jaVzSePtmBT2RgzdT bnqHOQFp1eRrCnmQ30th5AjqCp1sWgv/9W/vSVsKLQ7QFR8U3QWkk2vqac6wlNw8G2el DzxB+vkpPvNPhTgizPVEc8jxUYRzm4kAC7ShqvtyX5MolBPfqRrVg2GiQxh/PQDS5052 y/Jnp/UCKKZTyqtT2uXjrfpohzrCL2zjLLNdmXtiWlntgBABiYVi4EPO+QwsDogOVdwU mUZg== 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=+hHQ7wsBl8RIsaULgEBumRDcOvr0zqWBebVvGrNeQIU=; b=QFxNTrSRa0gY1FkE7tMimIBM9BRZCTb6AWfSSjbVRiVhD5ksz724UqsCtLXn6i5/Zq hE+4GmTemcThl6rsc2RbM9uWvFkI5uJJplR1OGEplDfY+TDLJhJ75kpG2ao8+SY4M9tp k44eoUsvtBHl1JGIlFaLYqWt64+pDAueq3F7uffeQ5LCRAZyznsVShPnTTENsmoSvsnQ 6582z5HRJq3FnedH5e0MOtSaV2lZ/vYVHPG4jpzo0yt85OTtpXCOQ87xZv7qgz0N2cEr BdamgHD8i7lTs4MQZg5PeEyKXGLBAamQRHp4DNm3dN+QNE6LtkDKWJtlBHbjacwNvJj7 OcMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QIbfzh8q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si3402013edu.343.2020.10.28.03.07.09; Wed, 28 Oct 2020 03:07:31 -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=default header.b=QIbfzh8q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760153AbgJ0Odi (ORCPT + 99 others); Tue, 27 Oct 2020 10:33:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:58212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760049AbgJ0Obb (ORCPT ); Tue, 27 Oct 2020 10:31:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 B8175206DC; Tue, 27 Oct 2020 14:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809089; bh=1Gr1VumVpL/J3/Rg8pZcI647T5nB3p5ZEscPdFL9Po4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QIbfzh8q2s1enLB7E3cwZKKMgkz4Jt/sGXFRBGwFxa68a/6J/j2IOb2qdeG9fVh2I LZSQUQ//xsAMzyjVZE51T/pGoRqRwa6t8gmmkHzb1NjBzOjmdyfOjdMeN2JHefHQ7v efF0P1i+zKBxkJU40gjMI6UkPL71pZePG02yP4z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 071/408] media: tuner-simple: fix regression in simple_set_radio_freq Date: Tue, 27 Oct 2020 14:50:09 +0100 Message-Id: <20201027135458.358601510@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix [ Upstream commit 505bfc2a142f12ce7bc7a878b44abc3496f2e747 ] clang static analysis reports this problem tuner-simple.c:714:13: warning: Assigned value is garbage or undefined buffer[1] = buffer[3]; ^ ~~~~~~~~~ In simple_set_radio_freq buffer[3] used to be done in-function with a switch of tuner type, now done by a call to simple_radio_bandswitch which has this case case TUNER_TENA_9533_DI: case TUNER_YMEC_TVF_5533MF: tuner_dbg("This tuner doesn't ... return 0; which does not set buffer[3]. In the old logic, this case would have returned 0 from simple_set_radio_freq. Recover this old behavior by returning an error for this codition. Since the old simple_set_radio_freq behavior returned a 0, do the same. Fixes: c7a9f3aa1e1b ("V4L/DVB (7129): tuner-simple: move device-specific code into three separate functions") Signed-off-by: Tom Rix Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/tuners/tuner-simple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/tuners/tuner-simple.c b/drivers/media/tuners/tuner-simple.c index b6e70fada3fb2..8fb186b25d6af 100644 --- a/drivers/media/tuners/tuner-simple.c +++ b/drivers/media/tuners/tuner-simple.c @@ -500,7 +500,7 @@ static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer) case TUNER_TENA_9533_DI: case TUNER_YMEC_TVF_5533MF: tuner_dbg("This tuner doesn't have FM. Most cards have a TEA5767 for FM\n"); - return 0; + return -EINVAL; case TUNER_PHILIPS_FM1216ME_MK3: case TUNER_PHILIPS_FM1236_MK3: case TUNER_PHILIPS_FMD1216ME_MK3: @@ -702,7 +702,8 @@ static int simple_set_radio_freq(struct dvb_frontend *fe, TUNER_RATIO_SELECT_50; /* 50 kHz step */ /* Bandswitch byte */ - simple_radio_bandswitch(fe, &buffer[0]); + if (simple_radio_bandswitch(fe, &buffer[0])) + return 0; /* Convert from 1/16 kHz V4L steps to 1/20 MHz (=50 kHz) PLL steps freq * (1 Mhz / 16000 V4L steps) * (20 PLL steps / 1 MHz) = -- 2.25.1