From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D874C4338F for ; Fri, 13 Aug 2021 21:42:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E344A60F51 for ; Fri, 13 Aug 2021 21:42:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E344A60F51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RhT5Y3dEPWCI2NBb74uFrgxwlGmiv/E7cmtAx9F17+o=; b=vwfyJ9u0+/d5s7 dXZdbOA7vZpr+BozQP9OqJzVoGhACAC+1wIz+QTFoxA0MsE2khJ3e3yICHgSe5QvqBOalqtVyQpsW Er/LAk8uCNxOh1t27uXnkqiRTfqPrleVou8ljaoLo9iU1ykkCVlblTZgZ2BFAlXLKO0y6PSbVlcPj 0OuaPBv8KDQZn3aPfyPZQgWebXlfwH1IyWP2sO7m8fo4ciywITJRkceGOEEm6R8RJFp3X7jj4iFwp TdHXhIgr71MDn8OjXXiws943u8CvGC0RHX1GZU0V59bCFXYhJBe5iUJ9xNtDCNfFUBr6G6aALsR/7 +1nxA1unhA6OCkH1WRIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEetp-00DcAF-0g; Fri, 13 Aug 2021 21:39:33 +0000 Received: from mail-qk1-f180.google.com ([209.85.222.180]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEetl-00Dc9i-4E for linux-arm-kernel@lists.infradead.org; Fri, 13 Aug 2021 21:39:30 +0000 Received: by mail-qk1-f180.google.com with SMTP id c130so12431875qkg.7 for ; Fri, 13 Aug 2021 14:39:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+ZCHXkE0Ngtxkg8sy8FZkEEy5v/vMEhkY+n7hsSWU9w=; b=KaMiLPeYVt6IE8ghgUepk5eYS7QDv+xPCIWOM13ApUAuTYFreV0DrWbySlKOPMswZi NY/ZQt1FY3E2rgtgBQlUs/CDEyfyrSqFuoZ63keLWM+gvPqp6W2HuPElKUNKsqC9zhXM BB6IQlZyWHz7kbPzAVYlhTm7BubQCnWeygniC8E+XMTpSR5DcXLxocJT117BdzLUIOGt drnvlvInjXFRcd1gBpcRJ+d/2q+Le9yTzTL84Y/oSeZmkjY3Ug4olPRkPjNJSCVAWW2f XxsoaEBgsVHREK98HWGRH12Dgpd4qxIlfWAd2Qjx6Fl3lc51CApdKoZJgL/yKZa26HqV 0PVQ== X-Gm-Message-State: AOAM533NuJ1gClt2kH6rx8Y/0AZlVY5LIrddGRdpcWaO5bG9JM8yB2lc pbdruD7yK1BzLK5WMz1CF0gomDTOv9Q= X-Google-Smtp-Source: ABdhPJx38jaHhTG7sGUdk24QPEaT1NxcrCORz7UU+5c6u18B2xxTaFH+lfhBGQcr+6sGapw4Jm1wxg== X-Received: by 2002:a37:b3c6:: with SMTP id c189mr4362268qkf.343.1628890766611; Fri, 13 Aug 2021 14:39:26 -0700 (PDT) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com. [209.85.160.178]) by smtp.gmail.com with ESMTPSA id x125sm1778948qkd.8.2021.08.13.14.39.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 14:39:26 -0700 (PDT) Received: by mail-qt1-f178.google.com with SMTP id t16so9436890qta.9 for ; Fri, 13 Aug 2021 14:39:25 -0700 (PDT) X-Received: by 2002:ac8:5c82:: with SMTP id r2mr3686098qta.283.1628890765336; Fri, 13 Aug 2021 14:39:25 -0700 (PDT) MIME-Version: 1.0 References: <20210811071036.44658-1-fido_max@inbox.ru> In-Reply-To: <20210811071036.44658-1-fido_max@inbox.ru> From: Li Yang Date: Fri, 13 Aug 2021 16:39:14 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] soc: fsl: qe: fix static checker warning To: Maxim Kochetkov Cc: Qiang Zhao , Saravana Kannan , linuxppc-dev , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Dan Carpenter , lkml X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210813_143929_213309_F6B4CABF X-CRM114-Status: GOOD ( 25.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 11, 2021 at 2:10 AM Maxim Kochetkov wrote: > > 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 > --- > drivers/soc/fsl/qe/qe_ic.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/soc/fsl/qe/qe_ic.c b/drivers/soc/fsl/qe/qe_ic.c > index e710d554425d..bff34ee2150a 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,9 +435,8 @@ 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) Probably should be <= 0 here. > return -ENODEV; > - } > > if (qe_ic->virq_high != qe_ic->virq_low) { Probably we should check if qe_ic->virq_high > 0 here if we rely on this to decide whether to set the handler later. Applied with the above changes. Thanks > low_handler = qe_ic_cascade_low; > @@ -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.31.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel