Received: by 10.223.185.116 with SMTP id b49csp2240826wrg; Sat, 24 Feb 2018 14:46:28 -0800 (PST) X-Google-Smtp-Source: AH8x224zDEgkpHOYoKQxcZ89t9l16rvKM3EWbVcdmAAVFp9e7X4PBl+OwjUrInkNuQahKP3QvkaZ X-Received: by 10.101.96.142 with SMTP id t14mr4779908pgu.58.1519512388849; Sat, 24 Feb 2018 14:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519512388; cv=none; d=google.com; s=arc-20160816; b=ihmcNaiiDpkI2utmCYOoQ6YBLL8UJk408gWZL/OvBPSeDRHZErRXcovkkKvysudJ9m vWUB3xMj2SaWnA6mdpZUy9dDKDOOpej9yAKmJoPl+Z1EoH2rGAYtI0YkjPphoz9K6ywE NvRh8z1oNmu7XBCZ7t6Zx1T8VmNDtLRJyJNj5leiGrsCQr2F7uYvG3t/PZwnDlDl2ICH +Mdy61T+c+Lbt0t92VlNDob/z5jae1hGdvX+4qlBJzVS9C1tCqmX8PNaZdv04/6EnrnD kXy3ZmmCufK16UddjnAFxiRuZOXsALk6X0ULOEmZaVYwVM399MlUZ6iAiijyzn6yet6W osNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=/o6iONfBOxEF0WAtXNw38Ern2cAoV4Dq/B4A2JN8CZs=; b=Qh8z+5o/+hCnuwiol7kDReUhv0mIebeqa4VCTa4/+C3WV2nKEGws+3vel2X9XRBTZH GXZTVcsYG7iqEjz1eLwiJDmOV0odq3SGLWJZAjIIAe9qQd1gyO8ajU3C/jw3bKMa2JoT rg1cCW+kyxZowur9W7KILTFsjw47/lKIIdxHBQwAlPdnHS+YdFjfSUfJrfLiJMcpqZOy hhQuitds/SRr00SlUoCvdmq0Vuy7/yVD+cYo4Ftg2EgW6qZ0v5LKzUemX1iyQJ/fZ0yn sDAYwUgRxoUg2fpqOVK8oj9WHg4LUiyXBSSIakVHoevvRAEj6YNJ1/1CZPDoL8b/jCRK 5FQw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o17si3448574pge.371.2018.02.24.14.46.15; Sat, 24 Feb 2018 14:46:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751785AbeBXWow (ORCPT + 99 others); Sat, 24 Feb 2018 17:44:52 -0500 Received: from agrajag.zerfleddert.de ([88.198.237.222]:33132 "EHLO agrajag.zerfleddert.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbeBXWow (ORCPT ); Sat, 24 Feb 2018 17:44:52 -0500 Received: by agrajag.zerfleddert.de (Postfix, from userid 1000) id 985A85B20D2E; Sat, 24 Feb 2018 23:44:50 +0100 (CET) Date: Sat, 24 Feb 2018 23:44:50 +0100 From: Tobias Jordan To: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wolfram Sang Subject: [PATCH] i2c: xiic: Fix PM device usage count Message-ID: <20180224224450.jss3gdnpsdhlfswk@agrajag.zerfleddert.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pm_runtime_get_sync() increases the device's usage count even when reporting an error, so add a call to pm_runtime_put_noidle() in the error branch. Fixes: 36ecbcab84d0 ("i2c: xiic: Implement power management") Signed-off-by: Tobias Jordan --- This is one of a number of patches for problems found using coccinelle scripting in the SIL2LinuxMP project. The patch has been compile-tested; it's based on linux-next-20180223. For a discussion of the corresponding issue, see https://marc.info/?l=linux-pm&m=151904483924999&w=2 drivers/i2c/busses/i2c-xiic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index ae6ed254e01d..fd03e40ca832 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -682,8 +682,10 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) xiic_getreg8(i2c, XIIC_SR_REG_OFFSET)); err = pm_runtime_get_sync(i2c->dev); - if (err < 0) + if (err < 0) { + pm_runtime_put_noidle(i2c->dev); return err; + } err = xiic_busy(i2c); if (err) -- 2.11.0