Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2892315pxb; Tue, 24 Aug 2021 10:00:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7YXchbytjVf8FpQaN2Qqc5d6DfLeKyIP3bhVYcLyicyAElc7tWCbaE4WJlczhawQ3cSFw X-Received: by 2002:a92:c145:: with SMTP id b5mr18051915ilh.150.1629824457633; Tue, 24 Aug 2021 10:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824457; cv=none; d=google.com; s=arc-20160816; b=qgcuV71LukyZci1E7pKbugHIdtrvHS7eFfV+HrswUORnfqw1YhcpRHt8WKbPWxzwqi XG91Xb5JwQ0CRDSWtfc8iJWZAuYZGDFuaflk3/Xi4u5fF9ccGHn26fjrYXtCFNhIx57l an4VN/VJu5DvivmO20Bu4kaEx/7LXoIYlHBpCRsgKv1oGBKnKp4N2z7Fiaf4oTNUshx8 P3zu+LoTpXMwkqc07VAWZtAkEdGOuWHpcGtocPUt31oUzzMij/O0G0J+zeaexCYkXVfh PBRciP6jRa2w1x1/S7maDGJNSlU/a4D9J6ckvEwTgIY09DSJ42F2m8ZlHtDOhgVjYTKe 0rLg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bTfeGSQ7PAp/kILshA08VhA4U2XGBYDl4OmXq8ikA08=; b=ztLkW7bEXU9l4Z+WjlNaGLHfrLiZpjzRvcTOd/hDxiqSx5Ta9k/zX3JUmMt0ey8WoP i1mXmv+uqJe5wGCr2q+2qz4d9HqO2g+pHYujwf2xJFOcm7qVDVTB3yK9qfi3MXJ4bQr3 dQ+bCsHYvyjIEbc4DV1244oRIVJBPYZExKuzInTEhPVdrhIEkiGL1j0totAVOt2aFkDL kLXEzMtCdSHFm/+0hpC2crYH9WYINzs1kQTCYoG+LFshgJLsBrFr9XqnWc5fXAx9Is3/ r4mlihLoiPcAcM+HK0GftGgDmtBWMVQwlOLXccJ+lutBziShJLlJcP8CxpAfFa7mIHNw Y4iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hg65MJGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si20863873iow.71.2021.08.24.10.00.43; Tue, 24 Aug 2021 10:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hg65MJGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235274AbhHXRA1 (ORCPT + 99 others); Tue, 24 Aug 2021 13:00:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234757AbhHXQ55 (ORCPT ); Tue, 24 Aug 2021 12:57:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BEB0B61465; Tue, 24 Aug 2021 16:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824222; bh=pfpt5pINwBubUuYsLHG4/nz5ZSTF5rZDrtrmJ8wmaE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hg65MJGb8C3yqK4kvKWhSaOMM7nHQhGnrL3KBYt1YkIUjZig/glawsGa73UEJssWU n7FJqQvJIYBgELfSiQenloCUba8G4q/xkmDSWbOpBgKb5n53r9l3KyRIsU7BuFdw5K MsTnx2n2p/bbMhvu3du9pU9Sje3UzgSyof7w8Q9b8bgU68WDzWLfBMMu8M9U+CLApf YiWBOkeALJGTBgZivimSJnzKFc84WlKftQoKPoqCFSWdisLMwbHmNblnDaLg2q3N0Q dxkjZDH8FwOy2ZOBU/hFJMXc+e6Xe3dhU2TW/F7HA2vzCuJZMA53XnGEafeh2VdDvS Iw3wfFylA8+xQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maxim Kochetkov , Dan Carpenter , Li Yang , Sasha Levin Subject: [PATCH 5.13 055/127] soc: fsl: qe: fix static checker warning Date: Tue, 24 Aug 2021 12:54:55 -0400 Message-Id: <20210824165607.709387-56-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kochetkov [ Upstream commit c1e64c0aec8cb0499e61af7ea086b59abba97945 ] The patch be7ecbd240b2: "soc: fsl: qe: convert QE interrupt controller to platform_device" from Aug 3, 2021, leads to the following static checker warning: drivers/soc/fsl/qe/qe_ic.c:438 qe_ic_init() warn: unsigned 'qe_ic->virq_low' is never less than zero. In old variant irq_of_parse_and_map() returns zero if failed so unsigned int for virq_high/virq_low was ok. In new variant platform_get_irq() returns negative error codes if failed so we need to use int for virq_high/virq_low. Also simplify high_handler checking and remove the curly braces to make checkpatch happy. Fixes: be7ecbd240b2 ("soc: fsl: qe: convert QE interrupt controller to platform_device") Signed-off-by: Maxim Kochetkov Reported-by: Dan Carpenter Signed-off-by: Li Yang Signed-off-by: Sasha Levin --- drivers/soc/fsl/qe/qe_ic.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_ic.c b/drivers/soc/fsl/qe/qe_ic.c index e710d554425d..bbae3d39c7be 100644 --- a/drivers/soc/fsl/qe/qe_ic.c +++ b/drivers/soc/fsl/qe/qe_ic.c @@ -54,8 +54,8 @@ struct qe_ic { struct irq_chip hc_irq; /* VIRQ numbers of QE high/low irqs */ - unsigned int virq_high; - unsigned int virq_low; + int virq_high; + int virq_low; }; /* @@ -435,11 +435,10 @@ static int qe_ic_init(struct platform_device *pdev) qe_ic->virq_high = platform_get_irq(pdev, 0); qe_ic->virq_low = platform_get_irq(pdev, 1); - if (qe_ic->virq_low < 0) { + if (qe_ic->virq_low <= 0) return -ENODEV; - } - if (qe_ic->virq_high != qe_ic->virq_low) { + if (qe_ic->virq_high > 0 && qe_ic->virq_high != qe_ic->virq_low) { low_handler = qe_ic_cascade_low; high_handler = qe_ic_cascade_high; } else { @@ -459,7 +458,7 @@ static int qe_ic_init(struct platform_device *pdev) irq_set_handler_data(qe_ic->virq_low, qe_ic); irq_set_chained_handler(qe_ic->virq_low, low_handler); - if (qe_ic->virq_high && qe_ic->virq_high != qe_ic->virq_low) { + if (high_handler) { irq_set_handler_data(qe_ic->virq_high, qe_ic); irq_set_chained_handler(qe_ic->virq_high, high_handler); } -- 2.30.2