Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1059587ybz; Sat, 25 Apr 2020 10:03:54 -0700 (PDT) X-Google-Smtp-Source: APiQypKkv+lu3U3G0RoimMcI02Zykpuv8lsXDWZHcM3tJ4vg0XMchlL7RnMKq7z7RC9ffWghjVI1 X-Received: by 2002:a17:906:cd1:: with SMTP id l17mr11969046ejh.319.1587834234194; Sat, 25 Apr 2020 10:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587834234; cv=none; d=google.com; s=arc-20160816; b=Pz7f4SNSFzXH/g4xYZwGimwIfSIQSeil9aiUyJ+1YwD7lhB/FtSqfPGUhdd0mms54R 719iUso0nJNX+wQuxF9QwdeY51QBiZNc0i5UXfMiUJoJPI0XAyrGiboUU6J7Fzdj5FBO do/2hjatL7Nh5saYwT5MakUfXtHjcCziveN1YNXUCBysDSGc9BOTG+jNtWQaZ8oVLLLS H8TGZ9ylPryRSMwqXiH4RdOy3ulYSGMT44B7DdCgW1bCBbF0EPL7rAr80QufBA44YMoJ Cl0xY9BmdFAoV/LdC+PmY8rkkpGVbw78KPJBXcEVCPZxVKcuh7WrGt7Ietiz6pHTiWQR ukhg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Kf6dy/S9Yg/vp2OInXS9wllrcElejomh147Wo0MI46Y=; b=vG0++gnd19Ry3rAMZ+cU6QJHDsiEFLfAhobmE2H1lxKbY0PQD4rnBcz/YzwYgfC/jk ULvwbENtUn/Ov3y8xN7ZsJYcwjOqbJlN2NgzS6zTUBb9tLxQZY7OodKuZUarozCFH4Gi BttnabzYhAohHHkwQnLqZbuCiM3wZ0KhB7Z4nZqL571hvocej//RD/ElIYR/Y/x/C8Cb seQ9SXsaiwH6kVMnzF0mHrOXR32BOXJ7HvI5AumK1EuI6Vdk/nRDa059VWgOVQB0T+CQ tRzYWImWz4Z/YoBWMbZWFQWssS7kvGoGCy2ocYnq58Yb5he17IKs9FHiH37zWn1DNgSy EvIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=elUDhyeG; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si5433610ejr.400.2020.04.25.10.03.30; Sat, 25 Apr 2020 10:03:54 -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=elUDhyeG; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbgDYRBP (ORCPT + 99 others); Sat, 25 Apr 2020 13:01:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:40484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgDYRBP (ORCPT ); Sat, 25 Apr 2020 13:01:15 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 23B9B206B6; Sat, 25 Apr 2020 17:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587834074; bh=gt3fpYTkrKObtHXD/pWODA9eL7Nil3GW9E4wiPFnZsI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=elUDhyeGLpVAWIboxfI9gncmA3dQ/XCSrHFj4TQaq7iWRdfwCJzVmiQCEnyxxrcIS fRIAfxI//TPr0jppQtXhM5ubHSKY+QXfNFYCyfBxyI7oZGoIQXWJ32Pcae8OiMmBnW ufVvh9hdock4NsfDcooY+NIDw6qnbV8bCuayk8pQ= Date: Sat, 25 Apr 2020 18:01:10 +0100 From: Jonathan Cameron To: "Ardelean, Alexandru" Cc: "lars@metafoo.de" , "linux-iio@vger.kernel.org" , "Bogdan, Dragos" , "pmeerw@pmeerw.net" , "knaack.h@gmx.de" , "colin.king@canonical.com" , "Hennerich, Michael" , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH][next] iio: adc: ad7476: remove redundant null check on an array Message-ID: <20200425180110.3ffa5696@archlinux> In-Reply-To: References: <20200424130419.22940-1-colin.king@canonical.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Apr 2020 15:01:26 +0000 "Ardelean, Alexandru" wrote: > On Fri, 2020-04-24 at 14:04 +0100, Colin King wrote: > > From: Colin Ian King > > > > The null check on st->chip_info->convst_channel is redundant because > > convst_channel is a 2 element array of struct iio_chan_spec objects > > and this can never be null. Fix this by removing the null check. > > > > Reviewed-by: Alexandru Ardelean Applied to the togreg branch of iio.git and pushed out as testing. I didn't take this as a fix as it's not doing any harm in the meantime whilst this patch goes the slow route. Thanks, Jonathan > > > Addresses-Coverity: ("Array compared against 0") > > Signed-off-by: Colin Ian King > > --- > > drivers/iio/adc/ad7476.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c > > index e9984a38fc4c..4e816d714ad2 100644 > > --- a/drivers/iio/adc/ad7476.c > > +++ b/drivers/iio/adc/ad7476.c > > @@ -309,7 +309,7 @@ static int ad7476_probe(struct spi_device *spi) > > indio_dev->num_channels = 2; > > indio_dev->info = &ad7476_info; > > > > - if (st->convst_gpio && st->chip_info->convst_channel) > > + if (st->convst_gpio) > > indio_dev->channels = st->chip_info->convst_channel; > > /* Setup default message */ > >