From patchwork Fri Jun 16 04:40:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9790501 X-Patchwork-Delegate: dvhart@infradead.org 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 5A63760326 for ; Fri, 16 Jun 2017 04:41:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58DFE2855C for ; Fri, 16 Jun 2017 04:41:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DC3A28608; Fri, 16 Jun 2017 04:41:57 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 F1C242855C for ; Fri, 16 Jun 2017 04:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752041AbdFPElR (ORCPT ); Fri, 16 Jun 2017 00:41:17 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35314 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbdFPElN (ORCPT ); Fri, 16 Jun 2017 00:41:13 -0400 Received: by mail-wm0-f65.google.com with SMTP id d64so2750607wmf.2 for ; Thu, 15 Jun 2017 21:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yhD1nJVB51lysWFgk737fLaLY0xHCEWYTXXAz9KKKmA=; b=QsyxvG5XCiWN+Q59VQ4C5PlCFRZ9w50SAisur+efiBqJ3YC0fOPznN9K/ejwKsGNMa N0y7/eDPkmonZxEPfz7R8n8bA6r2IrN4Q6QxEuby7h0dU7yMm129hMgzm5b06YauK6qX +chPkVkP++81x22/FnJpTZWeFIp2MnhntopoY= 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=yhD1nJVB51lysWFgk737fLaLY0xHCEWYTXXAz9KKKmA=; b=YgyugX97ArvjKmp6Fh5LhH4ddsw196zDYaH2uroqC9NNnvB1p/c/YRbZqHs1DiZX+p PfnogAlqRehyyy3ChO9t2YRYfNAatc3Tz/BDb12oQNVZI8UZC8Os4/wpfQWTb4UQTaUS 8IUQ9ua1BVXgeEGyLTvQM4OCrU7ICZbffORwvXdgefwc67jJIaBiESxbVtpZE/DuRMLz jiPDaz2PAAWBmDrMWhqaYd1Tf2/Cf0BLTqdVZI3NNCs8FVYLX19i7iBJGP0csHFiXyfY KV1ThFS9hxoplZ3/WPzVTxs1voYbunGGOzJec7CYMdMavWPUzbm6KypNmFDDudYPfpKe UFMw== X-Gm-Message-State: AKS2vOw1hJFnmnMZkMTjdnZvJ1toEpW0mh1d86Mn0eXK+IwpzprSh0Yy 8Gh6j6S5RdlJNMbupeo= X-Received: by 10.28.17.148 with SMTP id 142mr5721923wmr.44.1497588071975; Thu, 15 Jun 2017 21:41:11 -0700 (PDT) Received: from kmp-mobile.hq.kempniu.pl (kmp-mobile.hq.kempniu.pl. [2001:470:64df:111::2d90]) by smtp.googlemail.com with ESMTPSA id g3sm2026681wrd.11.2017.06.15.21.41.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 21:41:11 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] platform/x86: fujitsu-laptop: remove redundant safety checks Date: Fri, 16 Jun 2017 06:40:53 +0200 Message-Id: <20170616044058.30443-3-kernel@kempniu.pl> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170616044058.30443-1-kernel@kempniu.pl> References: <20170616044058.30443-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do not check whether the pointer passed to ACPI add callbacks is NULL as it is earlier dereferenced anyway in the bus-level probe callback, acpi_device_probe(). Do not check the value of acpi_disabled in fujitsu_init(), because it is already done by acpi_bus_register_driver(), which is the first function called by fujitsu_init(). Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 54cb7ae541d4..c64d5305ff37 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -406,9 +406,6 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) if (acpi_video_get_backlight_type() != acpi_backlight_vendor) return -ENODEV; - if (!device) - return -EINVAL; - priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -796,9 +793,6 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) int error; int i; - if (!device) - return -EINVAL; - priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -993,9 +987,6 @@ static int __init fujitsu_init(void) { int ret; - if (acpi_disabled) - return -ENODEV; - ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver); if (ret) return ret;