Received: by 10.223.185.116 with SMTP id b49csp5514708wrg; Wed, 7 Mar 2018 13:08:45 -0800 (PST) X-Google-Smtp-Source: AG47ELvb6H7cIIsg05BTjaJKV4hDXLmgmfrCkcZ4j4mLTLVuW2Er9Iy5hO6A0uyw2ECizIObjpJo X-Received: by 10.99.97.211 with SMTP id v202mr19134084pgb.193.1520456924881; Wed, 07 Mar 2018 13:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520456924; cv=none; d=google.com; s=arc-20160816; b=AnGjIQWeYvkgQttN44Sc2EfSW8C04gZDIMLbpq3ZtwjT0VSnsdOEDgVvNoqY/uTpwJ CDvfiYH+BI0YkE6YPTMBhffCcGJVKHFBH9Bc54WMbHTGp8cH4ESZD42oexOaTKteD/Su 4yWctSrePmxkg3vX3s66qnV6MPIq6wJfh2HDE1LP0iE6VTNeg/+26c2UwhMKQRKlFG5W kPL5BASPHSwJRLRVx8VQ8x95a1jiOnmFXwAnttaGXAwD5y4Qii2Pdi3NO5Xi/mnZ8Kun ir8O0cllthNJMXHAr0oSRvJAlkmYxbTBSArYRCjz1aXnAgsUuhvie9anVNs5m8T8sC6/ lMgA== 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 :dmarc-filter:arc-authentication-results; bh=rvXC84ICppN1cSGs20oo90hFKmN3K0ojahlgPwm8DsM=; b=SD9JFhR/39rPFFzTlP/YyE1XzQdJGztwCucZ8BN3Ab8lB8KPbJ1uN0ncVCcvJrotpf qzHl+ufx6NjrtBHw1KVbf2Khq526EZfETp0e2LazJuCETzt0TVJYmuFb0GPhDg2MjVKN M2ZuNz+nFXUAnMoH+CgsHSMjnrRUdMrjV5C/f8HctwiYB+Vbfe+b8A2+4nNixuxlO9gj pTxtmkwErX2Ofj2l20mV29zbBPawPCQD9Q9trbRgkEYSOo1YzRoKj5w5unLKOSe0CCdH 3q70HasvHeOzIghGYq50K6VUe7l5NrWc6PxSHxYBUAvWJh5uQ3oohUG5tBrhxWjRtpEP EPdw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p184si11943371pga.700.2018.03.07.13.08.30; Wed, 07 Mar 2018 13:08:44 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754779AbeCGVHf (ORCPT + 99 others); Wed, 7 Mar 2018 16:07:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:37420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333AbeCGVHd (ORCPT ); Wed, 7 Mar 2018 16:07:33 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (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 5DD942172D; Wed, 7 Mar 2018 21:07:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DD942172D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Wed, 7 Mar 2018 21:07:28 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com Subject: Re: [PATCH v3 3/4] Staging: iio: adis16209: Adjust a switch statement Message-ID: <20180307210728.59457080@archlinux> In-Reply-To: <5c523865f71eb68181bd2b207685bdf5e9b8da83.1520164945.git.shreeya.patel23498@gmail.com> References: <5c523865f71eb68181bd2b207685bdf5e9b8da83.1520164945.git.shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.16.0 (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 Sun, 4 Mar 2018 18:13:12 +0530 Shreeya Patel wrote: > Adjust a switch block to explicitly match channels and > return -EINVAL as default case which makes the code > semantically more clear. > > Signed-off-by: Shreeya Patel Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan. > --- > > Changes in v3 > -After split patch. > > drivers/staging/iio/accel/adis16209.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c > index eb5c878..9cb1ce0 100644 > --- a/drivers/staging/iio/accel/adis16209.c > +++ b/drivers/staging/iio/accel/adis16209.c > @@ -155,10 +155,16 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, > switch (chan->type) { > case IIO_VOLTAGE: > *val = 0; > - if (chan->channel == 0) > + switch (chan->channel) { > + case 0: > *val2 = 305180; /* 0.30518 mV */ > - else > + break; > + case 1: > *val2 = 610500; /* 0.6105 mV */ > + break; > + default: > + return -EINVAL; > + } > return IIO_VAL_INT_PLUS_MICRO; > case IIO_TEMP: > *val = -470;