From patchwork Thu Feb 22 09:14:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10234911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32398602DC for ; Thu, 22 Feb 2018 09:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E6F428ABF for ; Thu, 22 Feb 2018 09:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30AC128AC4; Thu, 22 Feb 2018 09:20:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F84D28AB3 for ; Thu, 22 Feb 2018 09:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753031AbeBVJUs (ORCPT ); Thu, 22 Feb 2018 04:20:48 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:50930 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027AbeBVJUr (ORCPT ); Thu, 22 Feb 2018 04:20:47 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1M9HAn3082844; Thu, 22 Feb 2018 09:20:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=9vPBB5UghZ3A+dXqlfT7PoTPJlRBMQiHGdwZhr6vDiY=; b=iVNv3DG4wlcNiVZmnNGlcWVyvgjBW+4IMUHKWHJidpyk0ETPOTARTEEck+AYc21OT/4C kXAIQ+aHx2V4RT4796MdXNT7TbvhhEgD1v0Lo0TzIISPMsgiRyZ1xPMdd8zzCFfm2ESA 3FTsj53EEIHTK55XYhgRPEs5JYpbXf8y6j69JyNd7QjJVqr6yGUVFTseWHGQDUeVhQVl Y8MwTRPnC3XzlGNwBfHCiRA12bl2/ENTeT5mjzabsAnm5EOmlyqum1KkcYf06r5yRJmK Ck0YmRgDeG6+00zbRUTAZrkkhNa/Q8CSIAka4tvRjJ5Iz9F7KO0S5m4t70fWsppesrWA nA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2g9u2r01e9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2018 09:20:11 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1M9FAoK029691 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2018 09:15:10 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1M9F90F003018; Thu, 22 Feb 2018 09:15:09 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Feb 2018 01:15:08 -0800 Date: Thu, 22 Feb 2018 12:14:53 +0300 From: Dan Carpenter To: Crt Mori Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] iio temperature/mlx90632: silence a static checker warning Message-ID: <20180222091453.GC9883@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.3 (2018-01-21) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8811 signatures=668676 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=921 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802220119 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This shouldn't affect runtime at all, but Smatch complains that we should check if mlx90632_read_ambient_raw() otherwise we "ambient_new_raw" can be uninitialized. drivers/iio/temperature/mlx90632.c:509 mlx90632_calc_ambient_dsp105() error: uninitialized symbol 'ambient_new_raw'. Signed-off-by: Dan Carpenter Acked-by: Crt Mori --- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index d695ab97d27f..9851311aa3fd 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -506,6 +506,8 @@ static int mlx90632_calc_ambient_dsp105(struct mlx90632_data *data, int *val) ret = mlx90632_read_ambient_raw(data->regmap, &ambient_new_raw, &ambient_old_raw); + if (ret < 0) + return ret; *val = mlx90632_calc_temp_ambient(ambient_new_raw, ambient_old_raw, PT, PR, PG, PO, Gb); return ret;