Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp523305ybh; Wed, 22 Jul 2020 06:42:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqCtXMqSVCOtvamo6H2H6t3hgkHjKvDjLBjJl4XGGwWKKqSyKCklH75o4mgoVowwM6d19w X-Received: by 2002:a17:906:1e85:: with SMTP id e5mr30020108ejj.76.1595425365900; Wed, 22 Jul 2020 06:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595425365; cv=none; d=google.com; s=arc-20160816; b=wz4ctIwYI9+v7en+Zzsp6Gbyq5QIbcT+I/3FIGNao0FRjd3lP60Muooke5w4EcyKYT BdxRcbo4ddnFMB+U+rT4fmDUG5dQdmaSefk2PHE2ONXGOy/8869seal8N9SpgxOTkOV9 /f327hd9ZPg72fxddFHkjPnYbBR0nUpqvxRr3zAGCIySpPc5VJIMPwrKK19RIC9zIMKJ 2/eCcW1/AUIBhtNPKZo6E+Kr2PEciDQxGyb357teRYdYJIW+Qom3TE/DRdxmzczat7NU OekJDYFAN0Y2EHpt93oOas8z/qo9jw+YRMpI6OKxxYA0e/zqWdt14ArU6ykyvb6nDrki Brrg== 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=Ui/vqY+wjCMXVC3AeuKik/PdHbSTYXnM22dr85QtBBc=; b=HSGVYFpHwN8VQGD4tZvVpbLoZYj3OGaa4zEvN319jbZX2UGq9vXbt6gj8VdyewrhYL RTZr5GAlHI6dcSq96n0CCGPjkUaw3v30RJYV/vIw2N4zxD/AJ2LpqKncZ/MwM4gEbwyk /gyqr9lSTKVh6/9xQ9kUdwpn+UO39vyPRInk5EBgzj034nXxbzPlaWK/tlgfA2CQZM5N d3KuMcFmkyj7oO4sX5U+oFyVMBEsBAmbQEj/iSOZzKwKOCmu7HLLB5CcPJZi0tCZO6kD RCoWSWhGPUaqP20N7aZH07RsMFzsK85x+sk89shpbWM/UPnZtfSoOJ88e9fxqG+ya00s trlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H7gfnWSL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck17si12392edb.508.2020.07.22.06.42.20; Wed, 22 Jul 2020 06:42:45 -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=@redhat.com header.s=mimecast20190719 header.b=H7gfnWSL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732441AbgGVNlz (ORCPT + 99 others); Wed, 22 Jul 2020 09:41:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:30974 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726425AbgGVNlz (ORCPT ); Wed, 22 Jul 2020 09:41:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595425313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=Ui/vqY+wjCMXVC3AeuKik/PdHbSTYXnM22dr85QtBBc=; b=H7gfnWSLuyI5gpnVjMVbBSFJQjjyv9riFiw2JlffDcH4X54jbixZpXb77VdcUQQsZNX2Sx 4a4dVQ3S+6xNTAQbCq4vwSyCfunKJ+UTtqSETMH0D08SzPPbPgQElSyB2LZaqLokGn5KN+ K+pdlT1D+VGyIbS5cyGXVQcz2Y/24yU= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-249-z3V4zKwWOluYp_goGHsLNA-1; Wed, 22 Jul 2020 09:41:52 -0400 X-MC-Unique: z3V4zKwWOluYp_goGHsLNA-1 Received: by mail-qk1-f199.google.com with SMTP id i3so1448041qkf.0 for ; Wed, 22 Jul 2020 06:41:52 -0700 (PDT) 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=Ui/vqY+wjCMXVC3AeuKik/PdHbSTYXnM22dr85QtBBc=; b=NNV2sW4zAQT5shQwuXhzkjH8OOuEHNXKRFYn/KD7zsB8lwRNPvsJQh1TfKlo80O72a V/jIqZyRlwv6bRhtwXBkyMjbVOl2YfVoIBDl05Y9BSVUx4uy6ZoCEl1BiFK547Nubenr Z6o8NjAoso/nk1ubzc/LCFHjHlzhPUBwvRZ3qbcxTA9D3FuPSGO6cUH/XMSh9IvgfgpJ /J3boed8VUxAbQ3lZ1wSJWdO7Y/UhtC3SiykWH2of0vkSM0teMn/rW0Ehkhq2QTMIJRC XuK1puEWT0gNcfjMf7gejcS8NfBTsgGQIcfhOVmNarrFdD6Th3ZitsXXAdhKXI5fVl50 b20g== X-Gm-Message-State: AOAM5301rSFNve6Qf1td7n03nme0Kqnw8MkVt4BHSiTCXbZZXWc220O5 oWt8HQN7UxEPB5apa0WEPGtrnJK4aXqojK3vdtolqL0url8MOBGJTEzIiSQCv1Snu7w4twJeJ3x 0se4qt18XK7Dg1SeqaOEbbiC4 X-Received: by 2002:ac8:7241:: with SMTP id l1mr34190476qtp.254.1595425311635; Wed, 22 Jul 2020 06:41:51 -0700 (PDT) X-Received: by 2002:ac8:7241:: with SMTP id l1mr34190457qtp.254.1595425311411; Wed, 22 Jul 2020 06:41:51 -0700 (PDT) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id f54sm27791224qte.76.2020.07.22.06.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 06:41:50 -0700 (PDT) From: trix@redhat.com To: jasmin@anw.at, mchehab@kernel.org, o.endriss@gmx.de, rjkm@metzlerbros.de Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] media: dvb-frontends/cxd2099: report errors Date: Wed, 22 Jul 2020 06:41:26 -0700 Message-Id: <20200722134126.31191-1-trix@redhat.com> X-Mailer: git-send-email 2.18.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix Clang static analysis reports this error drivers/media/dvb-frontends/cxd2099.c:420:2: warning: Undefined or garbage value returned to caller return val; ^~~~~~~~~~ In read_cam_control, the call to read_io can fail. When it fails val is not set. The failure status should be returned to the caller, not the unset val. Similar problem with read_attribute_mem Fixes: 0f0b270f905b ("[media] ngene: CXD2099AR Common Interface driver") Signed-off-by: Tom Rix --- drivers/media/dvb-frontends/cxd2099.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2099.c b/drivers/media/dvb-frontends/cxd2099.c index f88b5355493e..9dfaf18fc4b4 100644 --- a/drivers/media/dvb-frontends/cxd2099.c +++ b/drivers/media/dvb-frontends/cxd2099.c @@ -387,12 +387,15 @@ static int read_attribute_mem(struct dvb_ca_en50221 *ca, { struct cxd *ci = ca->data; u8 val; + int ret; mutex_lock(&ci->lock); set_mode(ci, 1); - read_pccard(ci, address, &val, 1); + ret = read_pccard(ci, address, &val, 1); + if (!ret) + ret = val; mutex_unlock(&ci->lock); - return val; + return ret; } static int write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, @@ -412,12 +415,15 @@ static int read_cam_control(struct dvb_ca_en50221 *ca, { struct cxd *ci = ca->data; unsigned int val; + int ret; mutex_lock(&ci->lock); set_mode(ci, 0); - read_io(ci, address, &val); + ret = read_io(ci, address, &val); + if (!ret) + ret = val; mutex_unlock(&ci->lock); - return val; + return ret; } static int write_cam_control(struct dvb_ca_en50221 *ca, int slot, -- 2.18.1