Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1226628img; Fri, 22 Mar 2019 19:47:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVSWu9qMjfiVvUe/xJhjcN/PhMCvi42XWFz5N6Hs5Yi+j+JXhL0PJHM7XBYibNWivWDhFp X-Received: by 2002:a17:902:e701:: with SMTP id co1mr13001646plb.61.1553309234131; Fri, 22 Mar 2019 19:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553309234; cv=none; d=google.com; s=arc-20160816; b=JUbvLyJU/8pV3VybWgwKXBbfY8UHxGkdjkJBY/WYAwHgvjRt3g3DizAfvOJIhFdv9f vzx+Ew77livcMrBhnFzoRzYlaOZVX38nwiDJWqTX68AcvcBcwkZpjIuyotnKMJJlnGnO /iCsFNBS7ZRoWdKrATa35axE45fFCrZ+/OK5IpK3MKWmShX816RRjrEAq7DFG6qpaFyu tl8L5Afv7/wUUnt07yCzpOcH+846ji8to/jbQXEEJ8jxuKgOParnvs+ixdx7PjMtPvf1 b4THcOklgZFlMjkvwPNBdAoxxi1nquS8xMy/ULY0uisIbd2dCp2DazMgwCrMf81S07wl dVIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=nurTLZi7ZZTrj3Ks+uFfVRbQaS2Tt+sCNdUD/Hv/o9Q=; b=EJPyXpqzLXM9JqjPqfZS+s+SDC5zFveIO1Yt9JoFwaIeDoVPFA1WFmNooSkp9jCcfp zYMzl6/G+/cPAnllXZJlS6VeKxk38OqfalEhecwW80Hqe58OfKdOK+JtCY8CSkUAGmvJ /nrt/bFHNSQIRFtojyW/np0e0JBH9IPffLB2jYClWQcVL6uQPTcbNt6qwhW17Gqgom1a Wnu8Kry5DEDtBu6F6PZQTod219WkK2fsu5gaeX9NsoJ60kwYCPaQWmjvwKfkdG8MD0VX /0zNK0ESaZK/MCsIlHA9AUMCboFdboisxNvTt5qktwasT4COehNSSR6WmPegrLugbiUw 1QHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=JUNGUJtL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t192si3788336pgb.124.2019.03.22.19.46.59; Fri, 22 Mar 2019 19:47:14 -0700 (PDT) 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=@umn.edu header.s=google header.b=JUNGUJtL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbfCWCqY (ORCPT + 99 others); Fri, 22 Mar 2019 22:46:24 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:52294 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbfCWCqY (ORCPT ); Fri, 22 Mar 2019 22:46:24 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id CD889E29 for ; Sat, 23 Mar 2019 02:46:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bn6H7Ns-wIAk for ; Fri, 22 Mar 2019 21:46:22 -0500 (CDT) Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id 94077E25 for ; Fri, 22 Mar 2019 21:46:22 -0500 (CDT) Received: by mail-io1-f69.google.com with SMTP id c2so3293438ioh.11 for ; Fri, 22 Mar 2019 19:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=nurTLZi7ZZTrj3Ks+uFfVRbQaS2Tt+sCNdUD/Hv/o9Q=; b=JUNGUJtLZUBeVEan8WJJBefh26iJoBoPz5fD9erfqLHOrEAMv5XuVoVrn4h+rOyBWI 6zgUJfNLFk+piU0Q89CjF1SLtI6X/OiHTqIU05ygcqhkX2ZQXD74Y2vDI7U9FPmDJ45J 8w8oxm/Vos/Ox5xjq2tn/4zOv+W3IEOMZ00WGA7qjXuD7mrECOBd1fae0ZNxVoKiIa+9 Taj11OBNgdwHhhfD24O2A4YPP/HB0IbZVC0wPVoedOy7/oXrHdJebnB568G8kDl25VKa 5s67CMtmHLxmibZcanyN36a+xZz1JnDgdQbU7HjxziYii7XwQxNzNRfZoDqApaYPEY+K UXIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nurTLZi7ZZTrj3Ks+uFfVRbQaS2Tt+sCNdUD/Hv/o9Q=; b=YbcHt9gep806/7oGJ7uBZsLzYFttqJ9nFd/RJ7OztE3TUT8ZV+RXADlj1ffiUJPIZv ++vcvRigL2RekTIXH61UzRJ9HGP+htsEwuFGefSfDfU/RJn/aRWAa6Xux0SCPEsR4vyt Xv2IRSAd4wsxP+tEMA4lHC7L7r6ofpt46Tht+uAThgi+TIef2j+yayzRtjOGSmqYbLjJ eAeQvQujbvSIu29ZWkKGoyfuxdeOKblws0byoDDgPOsC5lU4VGCKtHLSLjiPeInUMgAU 2DhvAgEe9KnHlPHWc51qgEAMQqrlJsdHJBTsX2kcOXACOjfhpVLt1aOeKNQ2mbqOPYLC ff8g== X-Gm-Message-State: APjAAAVj8zkerBBI6HybMNfEwrdhEEy+luL1N1DgLJ9kIKHs0UKAaXA+ uIKr6HLR3p1t59ldWsL8IS5+v51HuT0JzCZRiyG/oFvirFEKo1fDoSTUj21kTeteCKdLaJ6z05T Ut9cHSPHjTknE0tikOJUWPF8wEJ+3 X-Received: by 2002:a6b:fb02:: with SMTP id h2mr9617145iog.239.1553309182241; Fri, 22 Mar 2019 19:46:22 -0700 (PDT) X-Received: by 2002:a6b:fb02:: with SMTP id h2mr9617132iog.239.1553309182014; Fri, 22 Mar 2019 19:46:22 -0700 (PDT) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id w4sm4244384ioa.38.2019.03.22.19.46.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 19:46:21 -0700 (PDT) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: stv090x: add missed checks for STV090x_WRITE_DEMOD Date: Fri, 22 Mar 2019 21:46:13 -0500 Message-Id: <20190323024614.14883-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Conservatively check return value of STV090x_WRITE_DEMOD in case it fails. Signed-off-by: Kangjie Lu --- drivers/media/dvb-frontends/stv090x.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c index a0622bb71803..3e2af3969e16 100644 --- a/drivers/media/dvb-frontends/stv090x.c +++ b/drivers/media/dvb-frontends/stv090x.c @@ -1446,14 +1446,17 @@ static int stv090x_start_search(struct stv090x_state *state) /* >= Cut 3 */ if (state->srate <= 5000000) { /* enlarge the timing bandwidth for Low SR */ - STV090x_WRITE_DEMOD(state, RTCS2, 0x68); + if (STV090x_WRITE_DEMOD(state, RTCS2, 0x68) < 0) + goto err; } else { /* reduce timing bandwidth for high SR */ - STV090x_WRITE_DEMOD(state, RTCS2, 0x44); + if (STV090x_WRITE_DEMOD(state, RTCS2, 0x44) < 0) + goto err; } /* Set CFR min and max to manual mode */ - STV090x_WRITE_DEMOD(state, CARCFG, 0x46); + if (STV090x_WRITE_DEMOD(state, CARCFG, 0x46) < 0) + goto err; if (state->algo == STV090x_WARM_SEARCH) { /* WARM Start @@ -2604,7 +2607,8 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st if (state->algo == STV090x_BLIND_SEARCH) { tmg = STV090x_READ_DEMOD(state, TMGREG2); - STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c); + if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x5c) < 0) + goto err; while ((i <= 50) && (tmg != 0) && (tmg != 0xff)) { tmg = STV090x_READ_DEMOD(state, TMGREG2); msleep(5); @@ -2910,7 +2914,9 @@ static int stv090x_optimize_track(struct stv090x_state *state) pilots = STV090x_GETFIELD_Px(reg, DEMOD_TYPE_FIELD) & 0x01; aclc = stv090x_optimize_carloop(state, modcod, pilots); if (modcod <= STV090x_QPSK_910) { - STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc); + if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, aclc) + < 0) + goto err; } else if (modcod <= STV090x_8PSK_910) { if (STV090x_WRITE_DEMOD(state, ACLC2S2Q, 0x2a) < 0) goto err; @@ -2972,7 +2978,8 @@ static int stv090x_optimize_track(struct stv090x_state *state) reg = STV090x_READ_DEMOD(state, TMGOBS); if (state->algo == STV090x_BLIND_SEARCH) { - STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00); + if (STV090x_WRITE_DEMOD(state, SFRSTEP, 0x00) < 0) + goto err; reg = STV090x_READ_DEMOD(state, DMDCFGMD); STV090x_SETFIELD_Px(reg, SCAN_ENABLE_FIELD, 0x00); STV090x_SETFIELD_Px(reg, CFR_AUTOSCAN_FIELD, 0x00); -- 2.17.1