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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17577C433EF for ; Tue, 26 Oct 2021 15:22:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8B3660E74 for ; Tue, 26 Oct 2021 15:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235871AbhJZPZW (ORCPT ); Tue, 26 Oct 2021 11:25:22 -0400 Received: from smtp-relay-internal-1.canonical.com ([185.125.188.123]:41560 "EHLO smtp-relay-internal-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234738AbhJZPZV (ORCPT ); Tue, 26 Oct 2021 11:25:21 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E23123FFF8 for ; Tue, 26 Oct 2021 15:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1635261776; bh=8gTXC6kDWVMYoToYb5B6hbJrl2FdmKK5EeKfMKFu7aQ=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=SlxVavj/j5qJQvHBYe806kj610+zmFISg5FFFihKBPClFvrEEI6mtvoGyAMBkGXpm aa9svj4d0G07wgJ85iH15OnzwxkHKu16jn7nbLJNkGp05fc+mTLRhUJUa2TcQ2sdAz 3xAhJygy5Kj+yDzXjwhqSuMrKS/uLQuqMxcLVwEPquPXGTq9Xo5IW/Nxl7318uwbB+ dzzPV0k89CfjRcwJbfnV1StNq1dDuDPwYo/kvUawZI5qpoeDYOwXpqrT203UyJIjJe cdQ8bUmGfF+Va4vSPiLfKJ9wLgqjDt9c62UkXqmspCRcePJKAJb8q9eP4dIJQLfpcc /ucke+H8kavaw== Received: by mail-lf1-f69.google.com with SMTP id u17-20020a05651206d100b003fd714d9a38so1262166lff.8 for ; Tue, 26 Oct 2021 08:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8gTXC6kDWVMYoToYb5B6hbJrl2FdmKK5EeKfMKFu7aQ=; b=EW61Z81gZmVzZlNuGRCOyIrZLr3Dfg6Dhlx1LH5sczmzCKFsXTOIvCFhaN10AXyZqZ 26ML0Ttsj5RV1zkssNNl0XF3fQJO8jcpw4sNl/XuViG1wnL+ErOhVxTDa3ZLENZ5/CYG zQROL6qSFHlYX1q/9V7Lj4qK2VzAifBHOg06IlEPJM+bh4DcElQZddcOKxsyx+gpmULr LIBVRZOZHWJZi6AY3g3IdeKdpDA2rXNPTFCr6IdvVc6z5hzwqXEdbOk9EgrjiIJ6xNsY fz0nJMS2UH1DtTBdeWcQSnunMEOV34uONVIgQwizE7B5c1lNpcaLLBzHbLR0v67MBd+j GuUQ== X-Gm-Message-State: AOAM531OG5sMpvOt+srTgeEJzOWTe4d6t8Mq+rWg6xyQzZk7+AC/0oty s2p4HYaOFTGe+NNECYjTLh7r5a51pBH3CseeE8BoP3uDT3Z5iX23zxaR/7527htwrWX8KLIBedp NHq3Km/XbkMpnApqTqTooD6q7Qny5K5TZxQi0xTUVnd5VHom1 X-Received: by 2002:a05:6512:a8b:: with SMTP id m11mr23566142lfu.376.1635261776079; Tue, 26 Oct 2021 08:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlCNdMFwEXIZr86mohjVM6JadTYb6AKySe6zIb7iwY/lu2oUlq8/Du47vqUYSfMuBR8kLszg== X-Received: by 2002:a05:6512:a8b:: with SMTP id m11mr23566133lfu.376.1635261775914; Tue, 26 Oct 2021 08:22:55 -0700 (PDT) Received: from [192.168.3.161] (89-77-68-124.dynamic.chello.pl. [89.77.68.124]) by smtp.gmail.com with ESMTPSA id f14sm2267759ljc.108.2021.10.26.08.22.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Oct 2021 08:22:55 -0700 (PDT) Subject: Re: [PATCH v2] ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc() To: Arnd Bergmann , Jackie Liu Cc: "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" , Linux ARM , Jackie Liu References: <20210901123557.1043953-1-liu.yun@linux.dev> From: Krzysztof Kozlowski Message-ID: <957585d9-2f0f-7181-bba3-69c690c92f6f@canonical.com> Date: Tue, 26 Oct 2021 17:22:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On 26/10/2021 17:10, Arnd Bergmann wrote: > On Wed, Sep 1, 2021 at 2:35 PM Jackie Liu wrote: > >> + /* For platform based machines, neither ERR nor NULL can happen here. >> + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds: >> + * >> + * s3c_intc[0] = s3c24xx_init_intc() >> + * >> + * If this fails, the next calls to s3c24xx_init_intc() won't be executed. >> + * >> + * For DT machine, s3c_init_intc_of() could set the IRQ handler without >> + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no >> + * such code path, so again the s3c_intc[0] will have a valid pointer if >> + * set_handle_irq() is called. >> + * >> + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something. >> + */ >> + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) >> + continue; >> >> - if (s3c_intc[2]) >> + if (!IS_ERR_OR_NULL(s3c_intc[2])) >> if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) >> continue; > > I just saw this in the pull request. I'm taking the pull request since > it's a bugfix and > the resulting code is technically correct, but I'd point out that this > is particularly > ugly. Any use of IS_ERR_OR_NULL() essentially means we have a misdefined > interface, and it's clear that this is one of them. Yes, that's the case. > > Nothing actually uses the return code of s3c24xx_init_intc(), so returning > NULL on error there and changing all the checks to that would be a much > more straightforward solution. > > Any chance you could send a follow-up to do that? I can work on this but you know this is a legacy platform and none of us can test it? Best regards, Krzysztof 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBB16C433F5 for ; Tue, 26 Oct 2021 15:24:27 +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 A38F460C41 for ; Tue, 26 Oct 2021 15:24:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A38F460C41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.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:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sKojcr8zeOgb/db+4U1OZeDiJSTJ9fxW4KNHaMia5yw=; b=OkpsfhhVrA5jrnqnICIGYHoA3v Xul6vrMmy7Fk1a2JkrGqQmQN29apa9jj/rP1tlL9RUoNRP6PFE2ZK76syTZVOGTZ8ertBVRYAi0JF DICrPNk65ime9lCa+RlRT5G11WxOgjNHiQ/FhWzCbHNfi9TeJKWx94L7VJOT32SYU/VybHiO/uqcz KkCXtnrawtUZF5Er9Deus6iQX/dBPhmmr4RWk9aSyvPGJpBJFjHfrsstfFlLCJH7bFnaPxb/s2IMg HkNHYq+HIUZ63V0dM19dGI1dmaFt9lIRt7bFzFnCexIP9Rsa8lrocnAd2O0hEgLc+1HS8EVY7+vsT KJKBXL/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfOI4-0029he-HU; Tue, 26 Oct 2021 15:23:04 +0000 Received: from smtp-relay-internal-0.canonical.com ([185.125.188.122]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfOHy-0029fP-Hg for linux-arm-kernel@lists.infradead.org; Tue, 26 Oct 2021 15:23:00 +0000 Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 972BC3F173 for ; Tue, 26 Oct 2021 15:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1635261776; bh=8gTXC6kDWVMYoToYb5B6hbJrl2FdmKK5EeKfMKFu7aQ=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=SlxVavj/j5qJQvHBYe806kj610+zmFISg5FFFihKBPClFvrEEI6mtvoGyAMBkGXpm aa9svj4d0G07wgJ85iH15OnzwxkHKu16jn7nbLJNkGp05fc+mTLRhUJUa2TcQ2sdAz 3xAhJygy5Kj+yDzXjwhqSuMrKS/uLQuqMxcLVwEPquPXGTq9Xo5IW/Nxl7318uwbB+ dzzPV0k89CfjRcwJbfnV1StNq1dDuDPwYo/kvUawZI5qpoeDYOwXpqrT203UyJIjJe cdQ8bUmGfF+Va4vSPiLfKJ9wLgqjDt9c62UkXqmspCRcePJKAJb8q9eP4dIJQLfpcc /ucke+H8kavaw== Received: by mail-lj1-f200.google.com with SMTP id s17-20020a2e2c11000000b002119b8e1336so408238ljs.23 for ; Tue, 26 Oct 2021 08:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8gTXC6kDWVMYoToYb5B6hbJrl2FdmKK5EeKfMKFu7aQ=; b=7NcQAUWnorTblMnGTo6/zNfMycapoq7dTWm9XaJyCf3boZYr4ubKzTJcAbjVn7DFbF b70a8w4n8ng+0ojDYJWVmgNRp+YwoWeAkErkVuVeqm58BPCKl8mg4Z1wMIBl5F9c8pXh 5fDAa5Z4DuqYTWZuFuy4tNFxQCoRgrPeCb2vod9MDWGLGW3rxYMos/OwFbY+TjmezHqi GGhbwGW3pzFKeC9MY2ULGmKhylVwGVJm9djWQI4nl7qsEeHha/qkYv0b99cQwi/d3t2X l0Vw6WFGD3iZGq437d6F4RoLbxIYsH1PyAvLf2JSXzncIWoqE8qgM7PHI5ANg1RmcYdA Wtlw== X-Gm-Message-State: AOAM533qphYblYs9XQ5HA17wxpeJNnf3cxabeBtq8Iiy5Y80SQ9wEhl0 e+70YlLOLVS9VsP90W18hH+PrFEgl9O30ND+3hEnIk98LU9Wx0ijbJhrsogaESp2Nmk3q3IXS+t xyUn9H8t/KKmmSMjj7s2w1NrxwagfSriBqGwK6HtYzI7Ty+4HetDC X-Received: by 2002:a05:6512:a8b:: with SMTP id m11mr23566141lfu.376.1635261776078; Tue, 26 Oct 2021 08:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlCNdMFwEXIZr86mohjVM6JadTYb6AKySe6zIb7iwY/lu2oUlq8/Du47vqUYSfMuBR8kLszg== X-Received: by 2002:a05:6512:a8b:: with SMTP id m11mr23566133lfu.376.1635261775914; Tue, 26 Oct 2021 08:22:55 -0700 (PDT) Received: from [192.168.3.161] (89-77-68-124.dynamic.chello.pl. [89.77.68.124]) by smtp.gmail.com with ESMTPSA id f14sm2267759ljc.108.2021.10.26.08.22.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Oct 2021 08:22:55 -0700 (PDT) Subject: Re: [PATCH v2] ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc() To: Arnd Bergmann , Jackie Liu Cc: "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" , Linux ARM , Jackie Liu References: <20210901123557.1043953-1-liu.yun@linux.dev> From: Krzysztof Kozlowski Message-ID: <957585d9-2f0f-7181-bba3-69c690c92f6f@canonical.com> Date: Tue, 26 Oct 2021 17:22:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211026_082258_923735_ED9AD605 X-CRM114-Status: GOOD ( 24.58 ) 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 26/10/2021 17:10, Arnd Bergmann wrote: > On Wed, Sep 1, 2021 at 2:35 PM Jackie Liu wrote: > >> + /* For platform based machines, neither ERR nor NULL can happen here. >> + * The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds: >> + * >> + * s3c_intc[0] = s3c24xx_init_intc() >> + * >> + * If this fails, the next calls to s3c24xx_init_intc() won't be executed. >> + * >> + * For DT machine, s3c_init_intc_of() could set the IRQ handler without >> + * setting s3c_intc[0] only if it was called with num_ctrl=0. There is no >> + * such code path, so again the s3c_intc[0] will have a valid pointer if >> + * set_handle_irq() is called. >> + * >> + * Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something. >> + */ >> + if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) >> + continue; >> >> - if (s3c_intc[2]) >> + if (!IS_ERR_OR_NULL(s3c_intc[2])) >> if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) >> continue; > > I just saw this in the pull request. I'm taking the pull request since > it's a bugfix and > the resulting code is technically correct, but I'd point out that this > is particularly > ugly. Any use of IS_ERR_OR_NULL() essentially means we have a misdefined > interface, and it's clear that this is one of them. Yes, that's the case. > > Nothing actually uses the return code of s3c24xx_init_intc(), so returning > NULL on error there and changing all the checks to that would be a much > more straightforward solution. > > Any chance you could send a follow-up to do that? I can work on this but you know this is a legacy platform and none of us can test it? Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel