From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9E05C2BA83 for ; Fri, 14 Feb 2020 09:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7E0B2187F for ; Fri, 14 Feb 2020 09:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728522AbgBNJ0k (ORCPT ); Fri, 14 Feb 2020 04:26:40 -0500 Received: from mga02.intel.com ([134.134.136.20]:56730 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgBNJ0k (ORCPT ); Fri, 14 Feb 2020 04:26:40 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 01:26:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,440,1574150400"; d="scan'208";a="434725986" Received: from mylly.fi.intel.com (HELO [10.237.72.54]) ([10.237.72.54]) by fmsmga006.fm.intel.com with ESMTP; 14 Feb 2020 01:26:37 -0800 Subject: Re: [PATCH] i2c: designware-pci: Fix BUG_ON during device removal To: Andy Shevchenko , Wolfram Sang Cc: linux-i2c@vger.kernel.org, Mika Westerberg , stable@vger.kernel.org References: <20200213151503.545269-1-jarkko.nikula@linux.intel.com> <20200213161854.GA5929@ninjato> <20200213171102.GC10400@smile.fi.intel.com> From: Jarkko Nikula Message-ID: Date: Fri, 14 Feb 2020 11:26:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200213171102.GC10400@smile.fi.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On 2/13/20 7:11 PM, Andy Shevchenko wrote: > On Thu, Feb 13, 2020 at 05:18:54PM +0100, Wolfram Sang wrote: >> On Thu, Feb 13, 2020 at 05:15:03PM +0200, Jarkko Nikula wrote: >>> Function i2c_dw_pci_remove() -> pci_free_irq_vectors() -> >>> pci_disable_msi() -> free_msi_irqs() will throw a BUG_ON() for MSI >>> enabled device since the driver has not released the requested IRQ before >>> calling the pci_free_irq_vectors(). >>> >>> Here driver requests an IRQ using devm_request_irq() but automatic >>> release happens only after remove callback. Fix this by explicitly >>> freeing the IRQ before calling pci_free_irq_vectors(). >> >> Does it make sense to keep devm for irq handling, then? > I thought about it and decided devm still saves one line of code in drivers/i2c/busses/i2c-designware-platdrv.c: dw_i2c_plat_remove(). > Only for sake of better error handling in error path in the ->probe(). > Yeah, that too. -- Jarkko