From patchwork Fri Feb 9 15:38:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10209487 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E969160596 for ; Fri, 9 Feb 2018 15:38:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D99D428591 for ; Fri, 9 Feb 2018 15:38:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE4FF28B24; Fri, 9 Feb 2018 15:38:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F2B628A70 for ; Fri, 9 Feb 2018 15:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbeBIPio (ORCPT ); Fri, 9 Feb 2018 10:38:44 -0500 Received: from mga03.intel.com ([134.134.136.65]:43575 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbeBIPil (ORCPT ); Fri, 9 Feb 2018 10:38:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Feb 2018 07:38:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,483,1511856000"; d="scan'208";a="16573811" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Feb 2018 07:38:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A8BA85A; Fri, 9 Feb 2018 17:38:36 +0200 (EET) From: Andy Shevchenko To: dmaengine , "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, Mika Westerberg Cc: Andy Shevchenko , Sinan Kaya , Sakari Ailus , Vinod Koul Subject: [PATCH v4 2/4] ACPI / bus: Remove checks in acpi_get_match_data() Date: Fri, 9 Feb 2018 17:38:34 +0200 Message-Id: <20180209153836.19302-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180209153836.19302-1-andriy.shevchenko@linux.intel.com> References: <20180209153836.19302-1-andriy.shevchenko@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As well as its sibling of_device_get_match_data() has no such checks, no need to do it in acpi_get_match_data(). First of all, we are not supposed to call fwnode API like this without driver attached. Second, since __acpi_match_device() does check input parameter there is no need to duplicate it outside. And last but not least one, the API should still serve the cases when ACPI device is enumerated via PRP0001. In such case driver has neither ACPI table nor driver data there. Cc: Sinan Kaya Cc: Sakari Ailus Cc: Vinod Koul Signed-off-by: Andy Shevchenko --- drivers/acpi/bus.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index f1384e107eed..ca4af098b1bf 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -834,12 +834,6 @@ void *acpi_get_match_data(const struct device *dev) { const struct acpi_device_id *match; - if (!dev->driver) - return NULL; - - if (!dev->driver->acpi_match_table) - return NULL; - match = acpi_match_device(dev->driver->acpi_match_table, dev); if (!match) return NULL;