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: 9790519 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 D519A60326 for ; Fri, 16 Jun 2017 04:42:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D374A2855C for ; Fri, 16 Jun 2017 04:42:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C85CB28608; Fri, 16 Jun 2017 04:42:36 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 7F0492855C for ; Fri, 16 Jun 2017 04:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883AbdFPElP (ORCPT ); Fri, 16 Jun 2017 00:41:15 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36120 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751068AbdFPElN (ORCPT ); Fri, 16 Jun 2017 00:41:13 -0400 Received: by mail-wm0-f67.google.com with SMTP id d17so2754867wme.3 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=ANTex+tYShN02zuA+xgBR7pHU06CmNrJLaKiiD1sMQ57FISorh1FZsezfhG1mE/3of 6UfIVLLAEWPtkOuM40HT2A9dqersEUxizFxPy+D1aMZcgcLSqONA9uL6lBNHhNQzE7AY UTKtqOmNPb7bFDU+5yoy3/EOS/6iRKM1UkbPim2VffVy2xhHwJpuILdsJGOUubg2vM57 4HfekvTlo004FpIn98H62zBhHsftHNa2Z7vcBXjWPNeJhCeVwuihOKpbKily2bOCECjx nkTWZ2PiIVtIDz53uqxlVq/Bqx9FMysy4i3MmHl4sZxxp1BvVBZzDsdXqv1k2fu/NM4o bw6w== X-Gm-Message-State: AKS2vOy6VjnvU3oZY5EB+4Ij7WaQbRYV0xGAj0LR6s/FOkevcUtGrekf usfsGncvUJFttExL 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: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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;