From patchwork Mon Sep 30 16:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11166941 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F354D1747 for ; Mon, 30 Sep 2019 16:13:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2C3E21920 for ; Mon, 30 Sep 2019 16:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569859997; bh=1CyUodfL5DN4AO2K+oMMfrsSZCmGt+UR874+U98vD/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eknMvzldbDxkPbp/MoBZwOq4x9nMDBzaI7mxaFqc5oFf6XuuzCAedp1D6q4KG0jwZ 4Rk4XPdWS1uHr4eUJNcwW5ya/Lu8Iy4ovbmvZ+jNJE0+fAAvxYnvqRMnBlgCfYtFfo UaDd+InLM/YLQ01uQAX9YHhxW67xLytwCcYV6QHc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732215AbfI3QM7 (ORCPT ); Mon, 30 Sep 2019 12:12:59 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39211 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731967AbfI3QM6 (ORCPT ); Mon, 30 Sep 2019 12:12:58 -0400 Received: by mail-lj1-f195.google.com with SMTP id y3so10117554ljj.6; Mon, 30 Sep 2019 09:12:55 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+DoZWEhn4m4mbnXlcooHkZDNyGpeymNebsUFenCg8nY=; b=bJ//A9B7gRYgkD/y6dlzfF470TqJqe1HYJgyAWMC1JHwBuMa20SxDkMyNtgAimxCpl cPHTnMzzlpNkEeK5qfLxjFwrUadgviGGH6RVMLIjKp0ezteBFThZbspaUzX1fRunTWce VAfv8hj/3EgP2XSXDA+GVNzifJgOpflCwilNh9DPicpP+eGcl5C3iW6tbxjqaP7DN6yc rlH6KBzJg1hhnwG7ljJy84zzzYMp44zS0MYk/kZZ4WAcX/h6L1VXK8He4ygTuLgN8Yks nHilWgXO96BgEVN5m2sek8pAvIRP+X12ULii5ComAnFt4jYTDDqW9OvyUnf/i4RGQxxN 9Rnw== X-Gm-Message-State: APjAAAVJJq1A2H9rD3TAwEoun5/7u33zomoimdNlDyNKFithyq29Yp7P tWnazZ+x7Ybe9ShjcIBkUj3ZSLSn X-Google-Smtp-Source: APXvYqwPqTg0nXl80m6KpqMU5ibiF5xslTyhQgpT+xvaF9gdJN16Loa4YWLcxlnzCiV/KQraRuRTlQ== X-Received: by 2002:a2e:87cb:: with SMTP id v11mr12777943ljj.31.1569859975176; Mon, 30 Sep 2019 09:12:55 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id i6sm3208417lfc.37.2019.09.30.09.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 09:12:53 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iEyIG-0004uP-5Y; Mon, 30 Sep 2019 18:13:00 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 1/4] USB: usb-skeleton: fix runtime PM after driver unbind Date: Mon, 30 Sep 2019 18:12:02 +0200 Message-Id: <20190930161205.18803-2-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930161205.18803-1-johan@kernel.org> References: <20190930161205.18803-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") USB drivers must always balance their runtime PM gets and puts, including when the driver has already been unbound from the interface. Leaving the interface with a positive PM usage counter would prevent a later bound driver from suspending the device. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/usb-skeleton.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index f1a5861a0586..93c3fbc2ab1f 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -74,6 +74,7 @@ static void skel_delete(struct kref *kref) struct usb_skel *dev = to_skel_dev(kref); usb_free_urb(dev->bulk_in_urb); + usb_put_intf(dev->interface); usb_put_dev(dev->udev); kfree(dev->bulk_in_buffer); kfree(dev); @@ -125,10 +126,7 @@ static int skel_release(struct inode *inode, struct file *file) return -ENODEV; /* allow the device to be autosuspended */ - mutex_lock(&dev->io_mutex); - if (!dev->disconnected) - usb_autopm_put_interface(dev->interface); - mutex_unlock(&dev->io_mutex); + usb_autopm_put_interface(dev->interface); /* decrement the count on our device */ kref_put(&dev->kref, skel_delete); @@ -507,7 +505,7 @@ static int skel_probe(struct usb_interface *interface, init_waitqueue_head(&dev->bulk_in_wait); dev->udev = usb_get_dev(interface_to_usbdev(interface)); - dev->interface = interface; + dev->interface = usb_get_intf(interface); /* set up the endpoint information */ /* use only the first bulk-in and bulk-out endpoints */ From patchwork Mon Sep 30 16:12:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11166929 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8916F1599 for ; Mon, 30 Sep 2019 16:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 673492190F for ; Mon, 30 Sep 2019 16:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569859991; bh=Y6bBCAhnoN+oQaM/xasUAOl9f9CxTcwf2xIOYgxYlZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uZxtXHSGk+Wn5IsUJMmoRO7LICXpDgYyfkj5U381gdEHGc+o+zGa7IDBklEdU4Tzl YBtCI0xoU7TxFrhRIGXn84lsTy4TtMhnI0W32izyM/Ic0cNnxptUxULWxF3eamXOPa R8ZUyHgVjX0EeGRw6xZNQtxZ4P7zIsutypv7j9Tg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732251AbfI3QNC (ORCPT ); Mon, 30 Sep 2019 12:13:02 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37340 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732197AbfI3QNA (ORCPT ); Mon, 30 Sep 2019 12:13:00 -0400 Received: by mail-lj1-f196.google.com with SMTP id l21so10126667lje.4; Mon, 30 Sep 2019 09:12:56 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=JUd78FTTvuyVB+HT3mJkVtnKhl3dv/ZLiCCH/pdhHmA=; b=FxJQL6lCkGTG0oUl43mi4YekI03/XjCm5fFn8/M3uXElezfRm2WQnfV9cn4bUXz+Rn +Gba7ZX3I4k1eLrrLWyCb3vXfThBiO0Kl6jQtZe0l1TgKXoJLt08jKskCXplI8kVaNSL UgWji3ez1r4GpKyG4sfL4Qks4wkPaVRHCeZxY43E5wlC0O1jpxNwN5pyg8H5/PFFMusb Q1+hJ9PvTCOgd4dkBhxKLn4de6VplHVafxoaqyH7A9m0UUMgbyHQ+q0+S/tIecUh48B9 mCjiimHnyiAeR/7fX6eXRcdg/TT1WjnAbz6XzZy+oXwBSVHNT6OeRPyetTXE0P+avNFA TChg== X-Gm-Message-State: APjAAAW9ld9T37Qjjs//KiLkd3U+ZuOOYDHmbAxtKTPEYqKjs/yMHCMq uY01Jc1MCiAgdI1RQqeuRvM= X-Google-Smtp-Source: APXvYqyMcyWg8CQU5WiXBG5Yfg/ymiXCJ4rndvXh9ArLihkSuRJk+9BdMWklYGgOcheOVUnTfeII/g== X-Received: by 2002:a2e:9185:: with SMTP id f5mr12836712ljg.235.1569859975984; Mon, 30 Sep 2019 09:12:55 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id n25sm3459850ljc.107.2019.09.30.09.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 09:12:53 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iEyIG-0004uU-8n; Mon, 30 Sep 2019 18:13:00 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 2/4] USB: usblp: fix runtime PM after driver unbind Date: Mon, 30 Sep 2019 18:12:03 +0200 Message-Id: <20190930161205.18803-3-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930161205.18803-1-johan@kernel.org> References: <20190930161205.18803-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") USB drivers must always balance their runtime PM gets and puts, including when the driver has already been unbound from the interface. Leaving the interface with a positive PM usage counter would prevent a later bound driver from suspending the device. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/class/usblp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 7fea4999d352..fb8bd60c83f4 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -461,10 +461,12 @@ static int usblp_release(struct inode *inode, struct file *file) mutex_lock(&usblp_mutex); usblp->used = 0; - if (usblp->present) { + if (usblp->present) usblp_unlink_urbs(usblp); - usb_autopm_put_interface(usblp->intf); - } else /* finish cleanup from disconnect */ + + usb_autopm_put_interface(usblp->intf); + + if (!usblp->present) /* finish cleanup from disconnect */ usblp_cleanup(usblp); mutex_unlock(&usblp_mutex); return 0; From patchwork Mon Sep 30 16:12:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11166937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 076321599 for ; Mon, 30 Sep 2019 16:13:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA8F621855 for ; Mon, 30 Sep 2019 16:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569859995; bh=KelDtzYRHwDrGpc6YZP7ah7SpzPtAxZHrph0WJmy4fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kkuyilU86dS2sJzSU1XoxSTxOOPe54mobSu7d1Jyt2FMc8peD/RRwTGjur+vpxz9E fLAKW/fctkfOi4B3ILnQpuayhy4ofMQTSmxy3OCxUvr8xshmOlQa3VKn9651ZqOe31 EzQ5Advxkki+yitTPSdV8E17f1XzJjirKCEDGMDw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732233AbfI3QNA (ORCPT ); Mon, 30 Sep 2019 12:13:00 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:47067 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731459AbfI3QM7 (ORCPT ); Mon, 30 Sep 2019 12:12:59 -0400 Received: by mail-lj1-f196.google.com with SMTP id d1so10081622ljl.13; Mon, 30 Sep 2019 09:12:57 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=gEnKuOgkKrLviOK0l9N8El4AVdrpE1iBgXB7qlP+GeQ=; b=hpG7/EyhFyE3ab0KAxqk0Q0ZWxHxQe1MYsJD5+oo5uhVFEJU0VQwPlwGaL/kbgVqaH 4G72Gd10ntqLh5kqrW0o+HIaiYwvLQqlcm0Rv5W73f7EeOmTVU92BPIhDJNpzAOQr1Hy JRpoJVlNwTAiKi2SRLG567vLk4MJ0mdjtCVNGI+YmMyUoQu4PZ3CDCldagFjrXmqx2nD iT38dytEjxwILoLfqWuc+H50m6xUVmqDEAXMWHFyetIv5dqXuOguoIvbBXMPezIbbgF4 NlawXEihshrQYMzfF1WsO6kIVI76kMx0CGIMr8rT4u/3knsi4BR0iLaFCC512y6YhehB brKg== X-Gm-Message-State: APjAAAXUfQIMKy0o3kJE/0tmMsDB3Qh/gGc1gI9bN/6WPsN3N6rzB2HT GT6nFvoLTAAXfF1G3Sk8bMc= X-Google-Smtp-Source: APXvYqwOF/N0CXWKmJ6fTpKEVqlteqCm3V7fFmaN4n3H0vUsPdCvx7havB2AnvyalvE/lHR5MrQ+CQ== X-Received: by 2002:a2e:58a:: with SMTP id 132mr12149808ljf.132.1569859976722; Mon, 30 Sep 2019 09:12:56 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id r19sm3447505ljd.95.2019.09.30.09.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 09:12:54 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iEyIG-0004uZ-C4; Mon, 30 Sep 2019 18:13:00 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 3/4] USB: serial: fix runtime PM after driver unbind Date: Mon, 30 Sep 2019 18:12:04 +0200 Message-Id: <20190930161205.18803-4-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930161205.18803-1-johan@kernel.org> References: <20190930161205.18803-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") USB drivers must always balance their runtime PM gets and puts, including when the driver has already been unbound from the interface. Leaving the interface with a positive PM usage counter would prevent a later bound driver from suspending the device. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/serial/usb-serial.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a3179fea38c8..8f066bb55d7d 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -314,10 +314,7 @@ static void serial_cleanup(struct tty_struct *tty) serial = port->serial; owner = serial->type->driver.owner; - mutex_lock(&serial->disc_mutex); - if (!serial->disconnected) - usb_autopm_put_interface(serial->interface); - mutex_unlock(&serial->disc_mutex); + usb_autopm_put_interface(serial->interface); usb_serial_put(serial); module_put(owner); From patchwork Mon Sep 30 16:12:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11166935 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F73617E1 for ; Mon, 30 Sep 2019 16:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F70F216F4 for ; Mon, 30 Sep 2019 16:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569859993; bh=P3idOpXgTlaDUGkkYW5ETBO2kypVP5L2DHfguFM1WXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kFW+Y6+i2KiGE11/DfGgsC49DtBTfCH6zH5fT5CBehO4dfBc4/j/Fbvr3/5QQfpRl /IPAQwYJy/DlVeyQe+CZtHgljN0naICDJ+qxQyLuknxF1H+QlqVFWRzuyBsGAaGW9A X50Y+df5yPSu2XZxW1eaxRMJDG+KohheRbdZNZuA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732247AbfI3QNB (ORCPT ); Mon, 30 Sep 2019 12:13:01 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39099 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732198AbfI3QNA (ORCPT ); Mon, 30 Sep 2019 12:13:00 -0400 Received: by mail-lf1-f65.google.com with SMTP id 72so7482353lfh.6; Mon, 30 Sep 2019 09:12:58 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KXfl4ww2DrWF3pEnl8LcNO7G+susED8wh9HsxIg0JQw=; b=M4uQ+uA3fD0ziLfOUH7Zf0ikcuehxgwFrpIjo7/66z67aCaCQhxJNpiHA1R3MZ6lld Pc4yaYkk28A2czKYX24Z+32tyuOb64T1DnbHDh4LgOCj77hqo2hKp6UcZDzCYG03049Z H0NvdmFo6PGKtM66IPfVXELySp758/4qp0IIAMaEJx5yMr0pI/d4lQar6szpW8vQ0wtf e9lyYdDYX97spZnasNnNdYjVFVO0ga9JFlRk39lWjMzGOnuMBrDRzwykbjBZnXlOyqmp VgNAf0O+RAp/3Hsfl3iMCP2PxYyjaWsYdx/WykhnL33lH1oBZsP5dL1SwOwM9gqQgC9l ttoQ== X-Gm-Message-State: APjAAAVg1c9QTOizr7iadxGj2ow96aUiADt7WpaXJgY1EXEo7R5b89Gw C0Q74ITIscWYz8JyKxwUG04= X-Google-Smtp-Source: APXvYqwrLdfKkzjvjreL0RNH/iUPmuMtOzANmSTvmM0nPK7ujkTyEPLdzjwvfColyZhp8/frTUwJ/Q== X-Received: by 2002:ac2:5504:: with SMTP id j4mr12388515lfk.186.1569859977680; Mon, 30 Sep 2019 09:12:57 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id t16sm3457875ljj.29.2019.09.30.09.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 09:12:55 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iEyIG-0004ue-EZ; Mon, 30 Sep 2019 18:13:00 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Mauro Carvalho Chehab Cc: Pete Zaitcev , Alan Stern , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable Subject: [PATCH 4/4] media: stkwebcam: fix runtime PM after driver unbind Date: Mon, 30 Sep 2019 18:12:05 +0200 Message-Id: <20190930161205.18803-5-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930161205.18803-1-johan@kernel.org> References: <20190930161205.18803-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Since commit c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") USB drivers must always balance their runtime PM gets and puts, including when the driver has already been unbound from the interface. Leaving the interface with a positive PM usage counter would prevent a later bound driver from suspending the device. Fixes: c2b71462d294 ("USB: core: Fix bug caused by duplicate interface PM usage counter") Cc: stable Signed-off-by: Johan Hovold --- drivers/media/usb/stkwebcam/stk-webcam.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index be8041e3e6b8..b0cfa4c1f8cc 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -643,8 +643,7 @@ static int v4l_stk_release(struct file *fp) dev->owner = NULL; } - if (is_present(dev)) - usb_autopm_put_interface(dev->interface); + usb_autopm_put_interface(dev->interface); mutex_unlock(&dev->lock); return v4l2_fh_release(fp); }