Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp724822pxv; Fri, 9 Jul 2021 07:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynem685q7hON6J5iPZ+vkMVFf3SBF5dp+XgSwEu231pUUGNV2+q/iHthPHkXCBf7/W+kBq X-Received: by 2002:a17:906:7302:: with SMTP id di2mr37243930ejc.409.1625841550816; Fri, 09 Jul 2021 07:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625841550; cv=none; d=google.com; s=arc-20160816; b=wgrkk15sWQIlh1aSZFDpIJ0SQw83r5cjw3htLB8W6DxwhL1JeOlRXYMB1DDzcdohZ7 z0DolLUHo/Ro8K8YMfLB18d6AdSixyt9Kd7eYZv1F0wJ6NRTUDSRvQ1+92jFciXMygch Ro7mWsJbFpYUxiRcEkQcQZ8mANi0RmMq0Eb/H5t2ckUYE/vHv1I0BGfInaZ/u1vd7pE+ G0IbBtEKUkiaYHlF++bIRFEpI/klNU+9HBiO7Re1WPXi49cRILVkVvsaCsiAnuaxA+yk 3xYPar32qIdD3uML60Ssskg1c9rJO6sR7jZVefF5HfV768XRz1kNltQhD5Yqkq7fDpH8 ihYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2oLHoR0evNMi7gvD1QFI9k+vLZrAQjTKDrd/HEZ1Ms4=; b=Hm8MPw8ZCqHtknMiPbeDFbBYhT1ZCIlAJ/0mIPFs1gU4U60gSaMcFZqF1jg9Vya9wr Wv8StsxmCI/N8M+yCQdoa7vDFOmyvV4vwS2TJyFqc2MY/qHWsnMMLLx53huNcjp594lU KVLg3T/6SxN+zebCClW3adb5x/+VrFVZcAbhG7yp08/Jmx1F17A5LlC95jiemtJ5A7jF WKrDUGhaKR/Z5cF7AYhmMBDg1WLYePFJLobt4K4KkqqwtmrhTDCXXquY99G7qUatVrR8 vk7h3OLTCBWSE1Y5h8S1R9h7yvQ7fvbdr3o9MP/HVUoiBzjdYtA+384Tq2sP68QWPJFL GKdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=ApIdNMxu; 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=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si8270364ejc.737.2021.07.09.07.38.47; Fri, 09 Jul 2021 07:39:10 -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=@geanix.com header.s=first header.b=ApIdNMxu; 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=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231972AbhGIOh6 (ORCPT + 99 others); Fri, 9 Jul 2021 10:37:58 -0400 Received: from first.geanix.com ([116.203.34.67]:36992 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbhGIOhz (ORCPT ); Fri, 9 Jul 2021 10:37:55 -0400 Received: from skn-laptop (unknown [185.233.254.173]) by first.geanix.com (Postfix) with ESMTPSA id 3D2B04C63D7; Fri, 9 Jul 2021 14:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1625841307; bh=bh6RWvk3gmI+BmTSxLuJ9NcI8N1I3Z2smqLftpZU+y0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ApIdNMxurywsYvIo8oZfSSHfK/bjc6l5eWGbDvuLDGF7aHc5lVIsktOl6Qvsbokwh axeNpl9sOmQd71eFz71Y+uUXOMrTegznugOToWaHfy0YLXTo603yeXXXI2XTvDBfcV Lt8OuHb4+3SSD7JZXYQnET6ADMm1pZpo3LMmnZhbIW0Kq04k5Am08yJURWgTuBtmLk i0DKZ/CN/XDeGQl4P5XaT6fMw8yd3yPKgZRQxwtQYENdg6lF/HxAg2aGvZFZj2c2HQ Z2oTGaBg26YpNkEkxVyK3diNPB3rUb7nAATgFyaEHqScVkUUjoHnp3tVJwlJ8EjoVo rZmSdvyAlvOmA== Date: Fri, 9 Jul 2021 16:35:05 +0200 From: Sean Nyekjaer To: Souptick Joarder Cc: Fabio Estevam , Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Linus Walleij , linux-iio@vger.kernel.org, linux-kernel , kernel test robot , Dan Carpenter Subject: Re: [PATCH] iio: accel: fxls8962af: Initialize return value Message-ID: <20210709143505.4xzpols32j7rotpc@skn-laptop> References: <20210709031526.30746-1-jrdr.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on 93bd6fdb21b5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 09, 2021 at 07:50:48PM +0530, Souptick Joarder wrote: > On Fri, 9 Jul, 2021, 9:06 am Fabio Estevam, wrote: > > > Hi Souptick, > > > > On Fri, Jul 9, 2021 at 12:17 AM Souptick Joarder > > wrote: > > > > > > kernel test robot throws below warning -> > > > > > > smatch warnings: > > > drivers/iio/accel/fxls8962af-core.c:640 > > > fxls8962af_i2c_raw_read_errata3() error: uninitialized symbol 'ret'. > > > > > > Initialize it. > > > > > > Reported-by: kernel test robot > > > Reported-by: Dan Carpenter > > > Signed-off-by: Souptick Joarder > > > --- > > > drivers/iio/accel/fxls8962af-core.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/iio/accel/fxls8962af-core.c > > b/drivers/iio/accel/fxls8962af-core.c > > > index 078d87865fde..8af1c8f58e83 100644 > > > --- a/drivers/iio/accel/fxls8962af-core.c > > > +++ b/drivers/iio/accel/fxls8962af-core.c > > > @@ -628,7 +628,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct > > fxls8962af_data *data, > > > u16 *buffer, int samples, > > > int sample_length) > > > { > > > - int i, ret; > > > + int i, ret = -EINVAL; > > > > > > for (i = 0; i < samples; i++) { > > > ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB, > > > > Would the change below work? > > > > This function returns -ERRNO when failed. If it is not entering loop, > ideally it should return -ERRNO, not 0. No ? samples can't be 0, as fxls8962af_fifo_transfer() is never called if samples are 0 :) > > > > > --- a/drivers/iio/accel/fxls8962af-core.c > > +++ b/drivers/iio/accel/fxls8962af-core.c > > @@ -637,7 +637,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct > > fxls8962af_data *data, > > return ret; > > } > > > > - return ret; > > + return 0; > > } > >