Received: by 10.223.185.116 with SMTP id b49csp1554734wrg; Sun, 4 Mar 2018 04:44:57 -0800 (PST) X-Google-Smtp-Source: AG47ELukjsnz1v0jBLfSnRDxY5LC3mTI9PGZVh/GlHloLYEdZx03DiS5F3Itmk0/IvLtf0FvvA2g X-Received: by 10.167.130.88 with SMTP id e24mr1214671pfn.66.1520167497551; Sun, 04 Mar 2018 04:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520167497; cv=none; d=google.com; s=arc-20160816; b=zDKuL3rWGvntkfGrYTIunxU2LcFboKG8HMrfGhAkMxv1cGRAZ5QHkbkUH+5KEqXQ3J Inq6kPoAIc9p/Sdi4q/fMhNP9Y8pdykqmztihOP2Ra25nZTB7PlThRSrRTnFX2WaA5Ag rDUrs3ssAT9KvDmDPJebuIfEhklXbhL9bx1WE8Y3TTI25zVz9kW1vnmdSud4kwmmUOGq pDstgCISnI5zcrDYdg3+7z1kGLS5TsojWxJuPNIj/Rwlu55oG/ssSCOMLB3qREntAjnl 4LBlVkV4s8LH3r7dQSa9dTmn5iTmABJMcL7uxhlSGgFGmPZ/Zxlb0FR4Mm3z73TskuID J07g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=9+KosTM0HsuJ5G1V9461G0Qc8AXadDq/HJSXhjDOhvc=; b=a0Mck5N25/eTvJpKOpb1NdsGAdx5JTD38WOwVLD9LcC2thSY6Sd/rmEQJEj2DrBGKB CPAbkMj0ooMENnkeS6qc09bZ9Yk/wtp1Vn2TecUAVZXj2oMeKw6GyFPYVKhUFDLiQVJm 2IG90KaUcm4UnKiVDS9dtXx/4BVcAOHWsjVhkoo70XT7Toi/8SeQBYpkL+XodH0Go4U2 RBtgmaw0uULXCkDfKEgLPb51K+AkBHsAIkqrKDExPM0DY/uFNgn4ONX8Hu7S7SoVbA/U sI7sJNxRa9BYDcFuL08u71fwkBdTgz9PgMSNr0lXStcpEVWesZlV7mY6dpRDNq6Cytc2 wbDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1dNjPlW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si7795748plm.539.2018.03.04.04.44.41; Sun, 04 Mar 2018 04:44:57 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T1dNjPlW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752741AbeCDMnT (ORCPT + 99 others); Sun, 4 Mar 2018 07:43:19 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41007 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbeCDMnR (ORCPT ); Sun, 4 Mar 2018 07:43:17 -0500 Received: by mail-pl0-f65.google.com with SMTP id d9-v6so700786plo.8; Sun, 04 Mar 2018 04:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9+KosTM0HsuJ5G1V9461G0Qc8AXadDq/HJSXhjDOhvc=; b=T1dNjPlWeMycZhOBzVI4RbrwruGcPGCWY/MZ0oOc0NyKe/i8h1M0W8zE6VLKBeLDSI kpfUgiliWqTEs6tSPrs/0A5yDD3CzQx3Nzuw+6Uc5XtoHRBEi0q6GaMp7JQdooCZ/u7H /SXSt/mIAELBb8rc4nstoxcbSa54eYR0Vavuc+IeNiNuK50P+6Bz2P0sr9cBQWUiBaXd gJJMuqzxqqzVbSHQLu6qKYO0rprpXpqJ3qGlgJLLGezGJPxOxv+K4L8c3U9ot3gYstd5 GemAg+2kXnSRDxwcVTg5vbLdgmxFpzcmXAf2eNxolEJ2syRJk0mIRtRAdynqCZAl7fzy zgZw== 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:in-reply-to :references; bh=9+KosTM0HsuJ5G1V9461G0Qc8AXadDq/HJSXhjDOhvc=; b=moodALiu3Zj4gyyH0sjmVIuM/mmkM4SRh3ylP5t6nrQNvpKfArUlkY/hnl86SHHfRc gM/IBThHJexngNY5jsE0QjUYjoxsFvh9G3YN3T1jc6iyWXrBmVIn6XgxD89m1Mg1YMwy 5BIWCs9Zvt0AVT0yfHUn18zoBC7H+M+HagG2+xyaUeGh0U8wwS4DXLfKXn94jV8unysJ 4sdtQOwY2F418Pwkr1zmX5QlFISlEWFmF9Ejtp56Qcd0miPadtAo/0KaLKL9fYrof70h hFVCfioGWoqxXK6cYmvjcH9B4JMZ3pirjg30sZiywuFwiK4mp7l7yxtrAjFfwez/CQOS NVNQ== X-Gm-Message-State: APf1xPB+s94l8DQE7O5GeJyxVr99laGCgXE536rTAvGu1mTg7DXsnp63 UHg5lZhuBPKNQ8jBwpYhem4= X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr10157248pli.152.1520167396613; Sun, 04 Mar 2018 04:43:16 -0800 (PST) Received: from shreeya-VirtualBox ([103.212.140.139]) by smtp.gmail.com with ESMTPSA id k3sm17858106pff.41.2018.03.04.04.43.15 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 04:43:16 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, 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 Cc: Shreeya Patel Subject: [PATCH v3 3/4] Staging: iio: adis16209: Adjust a switch statement Date: Sun, 4 Mar 2018 18:13:12 +0530 Message-Id: <5c523865f71eb68181bd2b207685bdf5e9b8da83.1520164945.git.shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.7.4