From patchwork Wed Nov 1 21:05:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10037097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F262600C5 for ; Wed, 1 Nov 2017 21:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C85828BDC for ; Wed, 1 Nov 2017 21:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0160028BEC; Wed, 1 Nov 2017 21:06:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B412628BDC for ; Wed, 1 Nov 2017 21:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933433AbdKAVGR (ORCPT ); Wed, 1 Nov 2017 17:06:17 -0400 Received: from osg.samsung.com ([64.30.133.232]:44750 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933428AbdKAVGQ (ORCPT ); Wed, 1 Nov 2017 17:06:16 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id DF6D5118EC; Wed, 1 Nov 2017 14:06:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Nr9lB8vPcyq; Wed, 1 Nov 2017 14:06:14 -0700 (PDT) Received: from smtp.s-opensource.com (unknown [179.95.4.10]) by osg.samsung.com (Postfix) with ESMTPSA id F3DD91181A; Wed, 1 Nov 2017 14:06:06 -0700 (PDT) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.89) (envelope-from ) id 1eA0D6-0000jo-IR; Wed, 01 Nov 2017 17:06:04 -0400 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Sakari Ailus , Max Kellermann Subject: [PATCH v2 10/26] media: xc4000: don't ignore error if hwmodel fails Date: Wed, 1 Nov 2017 17:05:47 -0400 Message-Id: <06e27fc9b3ca44ced5f854b7e3b09984d5c26769.1509569763.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If, for some reason, reading the hwmodel register on xc4000 fails, it will cause the following logig to use a random value, as reported by smatch: drivers/media/tuners/xc4000.c:1047 check_firmware() error: uninitialized symbol 'hwmodel'. drivers/media/tuners/xc4000.c:1060 check_firmware() error: uninitialized symbol 'hwmodel'. drivers/media/tuners/xc4000.c:1064 check_firmware() error: uninitialized symbol 'hwmodel'. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/xc4000.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c index e30948e4ff87..2113ce594f75 100644 --- a/drivers/media/tuners/xc4000.c +++ b/drivers/media/tuners/xc4000.c @@ -1036,7 +1036,10 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, dprintk(1, "load scode failed %d\n", rc); check_device: - rc = xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel); + if (xc4000_readreg(priv, XREG_PRODUCT_ID, &hwmodel) < 0) { + printk(KERN_ERR "Unable to read tuner registers.\n"); + goto fail; + } if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, &fw_minor) != 0) {