From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BC2EC43464 for ; Sat, 19 Sep 2020 15:31:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B38242100A for ; Sat, 19 Sep 2020 15:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600529502; bh=Qohrf9BpoBZlJjpmOfnoyBggZccjSte4L1IkpPdEpwU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=hc21V0YRCWVZBkDs3XwWsfonT+ExiC3DFL3Xfwp36/m+66M13Liqe+vdoT+MNZJA1 g/z8djOemOk8kRC3fI+fWJmXaJYXtOzv7Zzv8xSRe+o/h4zEOEqUZ8Oo6qkmrCcwgY Hd0RbZi7Tl0s5Hg/Txh9six9e80ZHXTtx7hA6iDA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726606AbgISPbl (ORCPT ); Sat, 19 Sep 2020 11:31:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:47940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgISPbl (ORCPT ); Sat, 19 Sep 2020 11:31:41 -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 B0D302098B; Sat, 19 Sep 2020 15:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600529501; bh=Qohrf9BpoBZlJjpmOfnoyBggZccjSte4L1IkpPdEpwU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=e/aYfBvruQqkyRy9IScjqMSBrv3EGchdrqaBA9d2uosaBsMjSGGc+fUljN8ki4hsh QPrxI+zmiGdUdky2tsHk8hZbIzk/t7nT5zOp/vEph2FCmQA4O+fLDhir0jRRr49Q34 WhzVAsJuze/leLHb78+xH6JCm7kqw+ejRXEVv2Y8= Date: Sat, 19 Sep 2020 16:31:36 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: trix@redhat.com, Lorenzo Bianconi , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , linux-iio , Linux Kernel Mailing List Subject: Re: [PATCH] iio: imu: st_lsm6dsx: check st_lsm6dsx_shub_read_output return Message-ID: <20200919163136.4a201207@archlinux> In-Reply-To: References: <20200809175551.6794-1-trix@redhat.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Aug 2020 11:08:39 +0300 Andy Shevchenko wrote: > On Sun, Aug 9, 2020 at 8:56 PM wrote: > > > > From: Tom Rix > > > > clang static analysis reports this represenative problem > > > > st_lsm6dsx_shub.c:540:8: warning: Assigned value is garbage or undefined > > *val = (s16)le16_to_cpu(*((__le16 *)data)); > > ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > data is set with > > > > err = st_lsm6dsx_shub_read(sensor, ch->address, data, len); > > if (err < 0) > > return err; > > > > The problem with st_lsm6dsx_shub_read() is this statement > > > > err = st_lsm6dsx_shub_read_output(hw, data, > > len & ST_LS6DSX_READ_OP_MASK); > > > > The err value is never checked. > > So check err. > > > > > > Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support") > > > > Signed-off-by: Tom Rix > > You see, the commit message can be divided to three sections > > 1. Title / very short description > 2. Detailed description > 3. Tag block > > Each of them has some specific rules: > 1. One quite short line prefixed by subsystem / driver in the > specified format (usually gathered by reading git log against the > module in question) > 2. Should explain why this change is done > 3. Should be one tag -- one line, no blank lines in between. > > Hope, you will use this in the future. > > After addressing that (perhaps Jonathan will do it for you) > Reviewed-by: Andy Shevchenko Description adjusted and patch applied. Given timing in cycle I've queued this for the next merge window rather than trying to get it in during this cycle. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to see if we missed anything. thanks, Jonathan > > > --- > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c > > index ed83471dc7dd..8c8d8870ca07 100644 > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c > > @@ -313,6 +313,8 @@ st_lsm6dsx_shub_read(struct st_lsm6dsx_sensor *sensor, u8 addr, > > > > err = st_lsm6dsx_shub_read_output(hw, data, > > len & ST_LS6DSX_READ_OP_MASK); > > + if (err < 0) > > + return err; > > > > st_lsm6dsx_shub_master_enable(sensor, false); > > > > -- > > 2.18.1 > > > >