Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4326776imw; Tue, 19 Jul 2022 04:41:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tjCZHq1Qpz6s+q1sz6R7ubOAGn7W53MdRemGp42ofgCaohMfLfsIzfi+WLzoe5QKHJSYrB X-Received: by 2002:a17:907:2bde:b0:72b:4da0:6f3c with SMTP id gv30-20020a1709072bde00b0072b4da06f3cmr29982255ejc.623.1658230862995; Tue, 19 Jul 2022 04:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658230862; cv=none; d=google.com; s=arc-20160816; b=gbXt+ymm+J19dKAK3aqwLtRBhbB96PcvIawUg9iifLnlwTftNxTkwJ/9A7+xhtdIlr aTRod0ztw1uh54VVC1UokXmTjdmqa9Po4lLg/6fcOVUqjEtniaWubi4gUkOVMgqMEVnY D3gy3Ri1LQ1CZ7GNLJ5tGasS8j9mFPPHhUCgX3tx5RukL9wOQe8dekZhF1+JY1pQ8zoj Kyehixd7DLL9olr430ghX9Zzy668Hj0UKupXd43E0lIa/feNmmOv3bDa0a6wmM7QF9Nk kWZEKD1TqgoH5MFzy3gy1WnGlElrVoy608BcyPVEFxKEMkjFo99Z5Xs4JjS0Bwrsw66a kFFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xoCxQdQt+iV7AJQzuJsvyGKb5ZkGiBtZHbgEBy6Bzw8=; b=J/awAAdhHb+zpVJVEiT5mIHeI6c6OjOH92vkK6b5S9fNaXEV8Zn4gGGWzxnNez2kF1 Z9iTENqBg6PiT639t6Jq/aEKAbOaL9BQRIgbSHXL5CtmelO6MFgWwnIVybq29aFSz+oc tWjpSc7M3U5pa2H9qQLWGfkWbYAbe7FgZ7GXmiiMaydc852Tiu7Ws4LGCzoSvh2H22G1 NrcmDSgoZnSmpRUwdS4HppjG0NIZbM8el7QPRnXMoV71HQKugbLvfNYjOM6zTM7fY4cD 36tg5YRRwUv+PKEx6lRbR4qMvVt8/gEwZ49TYJc5C04jy1SOwCu9C67+KzhPzODvzxdC 7TLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020a170906915800b007277dd43476si15640037ejw.347.2022.07.19.04.40.36; Tue, 19 Jul 2022 04:41:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233749AbiGSLDw (ORCPT + 99 others); Tue, 19 Jul 2022 07:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbiGSLDv (ORCPT ); Tue, 19 Jul 2022 07:03:51 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA824255BB; Tue, 19 Jul 2022 04:03:50 -0700 (PDT) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPS id 9F00340D403D; Tue, 19 Jul 2022 11:03:48 +0000 (UTC) From: Andrey Strachuk To: Mattia Dongili Cc: Andrey Strachuk , Hans de Goede , Mark Gross , Len Brown , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] platform/x86: remove useless comparisons in sony_pic_read_possible_resource() Date: Tue, 19 Jul 2022 14:03:41 +0300 Message-Id: <20220719110341.7239-1-strochuk@ispras.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Local variable 'p' is initialized by an address of field of acpi_resource structure, so it does not make sense to compare 'p' with NULL. Local variable 'io' is initialized by an address of field of acpi_resource structure, so it does not make sense to compare 'io' with NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Strachuk Fixes: 41b16dce3905 ("create drivers/platform/x86/ from drivers/misc/") --- drivers/platform/x86/sony-laptop.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index d8d0c0bed5e9..07ef05f727a2 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -4341,7 +4341,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) { struct acpi_resource_irq *p = &resource->data.irq; struct sony_pic_irq *interrupt = NULL; - if (!p || !p->interrupt_count) { + if (!p->interrupt_count) { /* * IRQ descriptors may have no IRQ# bits set, * particularly those those w/ _STA disabled @@ -4374,11 +4374,6 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context) struct acpi_resource_io *io = &resource->data.io; struct sony_pic_ioport *ioport = list_first_entry(&dev->ioports, struct sony_pic_ioport, list); - if (!io) { - dprintk("Blank IO resource\n"); - return AE_OK; - } - if (!ioport->io1.minimum) { memcpy(&ioport->io1, io, sizeof(*io)); dprintk("IO1 at 0x%.4x (0x%.2x)\n", ioport->io1.minimum, -- 2.25.1