Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp307757imu; Thu, 20 Dec 2018 22:54:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/X4sjC8bh18sGHstxhl9/rb6V6Eq+ToeVOsKUEqkPSZ+Ksliwe3cKY5gszEQaRbFvbt8fg2 X-Received: by 2002:a62:5fc4:: with SMTP id t187mr1358127pfb.66.1545375248334; Thu, 20 Dec 2018 22:54:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545375248; cv=none; d=google.com; s=arc-20160816; b=Va+pH2RTJgbAxGR1Xc2YZ9DrVZHpjzQSGR4P5EpXKGI47kGSYkZ9+NEwDBxxrAcujw gMqFcFWHeZ1KInDDH3AydT0ulh0eEuMNHQm5g8ukg/dMoV/+X1x25Q/s/mNcZcIffP+Y eTbAMobaoRjIrS0fr4Xsi/wSvKP3ZInruevxdKJZUmvyB1DFcVqiS/2W3uF/VuHqv6b3 /R6YdADSfod8ZyiZ+1MhXi6OuO3yf01q9tNa1yDa70B1px6OKiX+0oPJK4eJ2BazrT9B lfy9AOyEZLKgxek1p61osXSNFTbPEUADW3nFfX06PVIomJ3vODvupzzEbLtU1nC5OB80 p7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=DCNlHdkvdIUGRN9ww792EColzsYz2mqQhXZ13uy+EAM=; b=F3d/0eTqUtw/6t7Lk9Q7MnEMfMpH636j48dR6ibLRV2xWe1KHfoljxSs2bNWTj6u1t 8FlyqeYwzc8rfXYXKG5jRiyyjLovsbAPvGHcGChGQ5wa8HgX5ASrEiQ/EKLiecdmcbWm f83+7bcuoOXfj54AF+DpkZyp78nRzqd6kRfzIJk2YrHjDUWsDkaZqmfFCP0WP7APf4d1 1Q3Yb+BqyGqgkSfxvqAVtCI+tevfRCtxhTX9I2mSBjjjBw1rrcn5Hl10eViDs7TSyz// SZmXNOoQToRT9OuFS3dH94ig+7kykxsr8qu1iATrYLBwZ3mxmW1IT8Vlzu2LqusukLXE c/Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=Vi8b8c+E; 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=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15si17839768plm.431.2018.12.20.22.53.52; Thu, 20 Dec 2018 22:54:08 -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=@umn.edu header.s=google header.b=Vi8b8c+E; 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=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387553AbeLTTvd (ORCPT + 99 others); Thu, 20 Dec 2018 14:51:33 -0500 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:52990 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732114AbeLTTvd (ORCPT ); Thu, 20 Dec 2018 14:51:33 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id 84D349C8 for ; Thu, 20 Dec 2018 19:51:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RbqLMdHwvAy2 for ; Thu, 20 Dec 2018 13:51:31 -0600 (CST) Received: from mail-it1-f200.google.com (mail-it1-f200.google.com [209.85.166.200]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id 58BD9514 for ; Thu, 20 Dec 2018 13:51:31 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id i12so2633787ita.3 for ; Thu, 20 Dec 2018 11:51:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=DCNlHdkvdIUGRN9ww792EColzsYz2mqQhXZ13uy+EAM=; b=Vi8b8c+EMz1/I1CM8QktxdJxf5M2bVA6wCChCLYlpiFA79j4MMsN41zYDRPayfzG0n xukf2ZMz8vlkRE1phxdwFXGt4GsnZJHzUrAuhFVJ+xP77LqOYPLrBvXGmq4PtPCMk6E8 3+bG2H1c5ROZO1wBhjC8+2767l6lRVIuEel2BWmqFzXL9hlSvcLyDc0Im/PH8h84eG7i kXrQjBeh1RiArvMch7iSRXY8lVoTZ6h7ts2cSjN+YtmjzMV0SmfMDCz6e5eUGEZ4YsYg ZGqYjMK1Dpx+Mk1adS283EkRNDp7tfYJQBoYY06FZ5cHzX8GBGTQnOkmntowdi3VbWR+ BDJw== 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; bh=DCNlHdkvdIUGRN9ww792EColzsYz2mqQhXZ13uy+EAM=; b=GNM1FylVauOqqVHPCkWUXUz1Ys1cD+VTeebFWgxtTJeE8Nymp2zS6IqYIIYcKfrcal +T2WGMnDJKQIb/EbFSYvwfwnCclZHL6nIn+ayZJLWdfd1dhepDXe4XLp6PcT6VOQRRA6 LzV114MYOF7nObHI2NTVQ6rRAM4lOckhjeNAdE/V30I30IPdQYhOQuuVSNu6r8PK5tco stPO1JlZ+lqltRot2PH3oicIszQ0Q2IRCTBBNpGVLybYKN/UwDtp5CRTaQ/IXncw4peM odD/gTXUDhO93EASu9CChEHfls474Y4lMJ/RHQBkwI4tmC8XnVIAuNTEml4k2hJKNb0t Fi/w== X-Gm-Message-State: AJcUukfPfZU/VlcQQpgjOQb+Z3pFJBZB2ERnJqbUsCoM3OuoluLriEMh Fn230xJyOVg8SaRsVjtkF5xVpoLs5j75ymeSJW26vvhSMHiETU1gM5Z9G/uyz2+4Na4vURKQNf3 U2uaKywLPVl8rhUzq8RzOYfAnm74H X-Received: by 2002:a24:4545:: with SMTP id y66mr17605ita.174.1545335490933; Thu, 20 Dec 2018 11:51:30 -0800 (PST) X-Received: by 2002:a24:4545:: with SMTP id y66mr17595ita.174.1545335490694; Thu, 20 Dec 2018 11:51:30 -0800 (PST) Received: from bee.cs.umn.edu (cs-bee0u.cs.umn.edu. [134.84.121.28]) by smtp.gmail.com with ESMTPSA id 197sm5314454itx.21.2018.12.20.11.51.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 11:51:29 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Sebastian Reichel , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] power: twl4030: fix a missing check of return value Date: Thu, 20 Dec 2018 13:51:24 -0600 Message-Id: <20181220195124.29467-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If twl4030_bci_read() fails, the read data in "s" is incorrect, which is however used in the following execution. The fix checks the return value of twl4030_bci_read() and returns an error code upstream upon the failure of twl4030_bci_read(). Signed-off-by: Kangjie Lu --- drivers/power/supply/twl4030_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c index 0e202d4273fb..4299873a1118 100644 --- a/drivers/power/supply/twl4030_charger.c +++ b/drivers/power/supply/twl4030_charger.c @@ -809,7 +809,9 @@ static int twl4030_bci_get_property(struct power_supply *psy, is_charging = state & TWL4030_MSTATEC_AC; if (!is_charging) { u8 s; - twl4030_bci_read(TWL4030_BCIMDEN, &s); + ret = twl4030_bci_read(TWL4030_BCIMDEN, &s); + if (ret < 0) + return ret; if (psy->desc->type == POWER_SUPPLY_TYPE_USB) is_charging = s & 1; else -- 2.17.1