Message ID | 20230923114807.2829188-1-harshit.m.mogalapalli@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp328740vqu; Sat, 23 Sep 2023 12:01:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPYHr+Qt9HJ7rn3ms4nZkTBCZVMrpURaTYlOFQEFYFT8QNi6Zdwsp6cf4xH8+7A6nRxGfO X-Received: by 2002:a17:902:da8e:b0:1c0:d575:d28 with SMTP id j14-20020a170902da8e00b001c0d5750d28mr2835873plx.50.1695495691981; Sat, 23 Sep 2023 12:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695495691; cv=none; d=google.com; s=arc-20160816; b=dSsRcv2R4LADUmTNh3D2Yd5QzuSbCa1x7w7n3KWbY3Wk5VIhAX/5Xih4BDOExVChNa /ua0IcsGhD7fBVf0NBfpL2ijS+hYXZZ3tTDlNuQB46F9s6WDqVO4U0wETRz82s3C87p5 VGLl1Gqs2LpyqmwIvaJpfL+owi+LS1RdtvSjUkjvjALH9PmntgXrCQ/OMyhchrxUfSY7 u5Z9KHDPnIIluikpFhPQMAlD7mLPadz94Xbek5CFbl+yiS8DjEz9DCwuYVDE3IOPUJSp I23yGPDhPyCrLfyhN8+iy0yMBoRn/e8HrlH8le/iFPM+La2HrxNulKQLx/X+h5tMkwoc VUUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MbbdfnIprRaXRgZX4bukDl9QS5PDJbFVxm3H6/bcw+8=; fh=Qbn799IUbf+kgFEMTdIcf+DLdnj+v6kOhoje7qUdsJ0=; b=fdcIIwV5DziFQxCHPBG7Jy0TGPXxn7mDreSTSvsmSlLRSct201sQCnd8PDH5hBEBW0 Yu8QXEvGoIPVDmIp5hKks7CVgpH35WQ87500z1nuncpc0SZYw5Q1WxJ9FRqIzPHTI4pp 2up4VB7ZO5Au8dWdTuFHsP8cQPcCuERbQEpvevw8utaNcdOV6b2jmsZGbT1BjpNU0aqX 2+3IM1wt9eWWNix7U7Y41oT1uxFN2LE1rCL49r7HK+bfKAOULazqjh3vYCB8H/F+8DpO tYcIlz0dGpPTmCQbz1yUXQ+mGbutmNr7kF4zSV91kOon7JVZWiySvwHz8QnTXiwkkH6W 1Xbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="N89AaHg/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y14-20020a17090322ce00b001c4155c310csi7218147plg.94.2023.09.23.12.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 12:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b="N89AaHg/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 23571802530E; Sat, 23 Sep 2023 04:48:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjIWLsb (ORCPT <rfc822;chrisfriedt@gmail.com> + 29 others); Sat, 23 Sep 2023 07:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbjIWLsa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 23 Sep 2023 07:48:30 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F499F; Sat, 23 Sep 2023 04:48:23 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38NBlxAS028604; Sat, 23 Sep 2023 11:48:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=MbbdfnIprRaXRgZX4bukDl9QS5PDJbFVxm3H6/bcw+8=; b=N89AaHg/TdfpR/vPiFjH5I5JjBk2L+lVaI8b8DxPe8eQRm/1ReV+lzAsKEMK5ys+HzLk 6LKkMHb4AvSEhTFW70z+o/b5gJJ39pVYWCah+sSYEymv0k8Equ0qegn4Qmz8ZgphaHlX ax5/jB1VbxeG7JLKD6If2G9r2bIimwwzZw7eu+fAhgkLJLnlPd3VGBhIWtseTTBKEMha HDDnk+zlLOJG9HjoVMQf0MrzXFSChLIQmdmA8MePiArjCLjzj0hIsbSAi0QAHGGnwmsv P9lub+Og3taeU3rNW/BA7P5PzP/NBsUbBsyBx5cf8LMjpFi6JMEalLd0hU4A06mZbl3J 0A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qwb8yn5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 23 Sep 2023 11:48:12 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38NBLoUr017972; Sat, 23 Sep 2023 11:48:11 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pf8n6wd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 23 Sep 2023 11:48:11 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38NBmAY5021486; Sat, 23 Sep 2023 11:48:10 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pf8n6w1-1; Sat, 23 Sep 2023 11:48:10 +0000 From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> To: Konrad Dybcio <konradybcio@kernel.org>, Sebastian Reichel <sre@kernel.org>, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org, error27@gmail.com, harshit.m.mogalapalli@oracle.com, kernel test robot <lkp@intel.com> Subject: [PATCH next] power: supply: mm8013: Fix error code in mm8013_probe() Date: Sat, 23 Sep 2023 04:48:06 -0700 Message-ID: <20230923114807.2829188-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-23_09,2023-09-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309230097 X-Proofpoint-GUID: Ys6HgNCpVyI69ggK3IvPX8U7Wih9dzuo X-Proofpoint-ORIG-GUID: Ys6HgNCpVyI69ggK3IvPX8U7Wih9dzuo X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 23 Sep 2023 04:48:42 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777856090795286141 X-GMAIL-MSGID: 1777856090795286141 |
Series |
[next] power: supply: mm8013: Fix error code in mm8013_probe()
|
|
Commit Message
Harshit Mogalapalli
Sept. 23, 2023, 11:48 a.m. UTC
The value of ret is zero when passed to dev_error_probe(), we are passing
zero to dev_err_probe() is a success which is incorrect.
Fix this by getting the error code using PTR_ERR().
Fixes: c75f4bf6800b ("power: supply: Introduce MM8013 fuel gauge driver")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202309190838.eu8WS6sz-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis with smatch, only compile tested.
---
drivers/power/supply/mm8013.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On Sat, 23 Sep 2023 04:48:06 -0700, Harshit Mogalapalli wrote: > The value of ret is zero when passed to dev_error_probe(), we are passing > zero to dev_err_probe() is a success which is incorrect. > > Fix this by getting the error code using PTR_ERR(). > > Applied, thanks! [1/1] power: supply: mm8013: Fix error code in mm8013_probe() commit: 43ee22422db545800b8bf2c24ef53d040372fc7a Best regards,
diff --git a/drivers/power/supply/mm8013.c b/drivers/power/supply/mm8013.c index ddac40ef9ae5..29fd65fe6545 100644 --- a/drivers/power/supply/mm8013.c +++ b/drivers/power/supply/mm8013.c @@ -273,8 +273,10 @@ static int mm8013_probe(struct i2c_client *client) chip->client = client; chip->regmap = devm_regmap_init_i2c(client, &mm8013_regmap_config); - if (IS_ERR(chip->regmap)) + if (IS_ERR(chip->regmap)) { + ret = PTR_ERR(chip->regmap); return dev_err_probe(dev, ret, "Couldn't initialize regmap\n"); + } ret = mm8013_checkdevice(chip); if (ret)