Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1089126pxb; Tue, 17 Aug 2021 03:38:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkY/yAZ+3UOHKpP9G79b0oHoSWdhs5hr+w8ycuUGR0PT4ByQt21mOhxnotHF5kSQvkpJaW X-Received: by 2002:a02:b697:: with SMTP id i23mr2390303jam.78.1629196691918; Tue, 17 Aug 2021 03:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629196691; cv=none; d=google.com; s=arc-20160816; b=bqORFnrxzkCFXAGmUj9mr641owU68rm8lI+BCMyMuw9A0PzRdEmR5V1W7rchD0OJdA 9g8lmAO9ypksigIK4egV0ivp3gvKn9eo3NGbNKGvssOD5tdODxUzJ0X70IVxpn/5w4to XaRUmyieREwCiImg38+GlUU1MJILyTMzDn190IcpjLxhAXthbiSh6Z8CNJHDGg3QSwbr 1c9AVScm025XPLV7KGP3BcD7/XSo9ftsDnlTzYzr8LlMTLk1eAMTrGudoOgPccYAU7yI Lo6+zcVJkkS26Te31sF4vwjdkbMnN2JWGLlYkoHFxS4UGYiGIBceqBBWyxfExqmRMcZ6 4vsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=VIThmxBHXg1GIWPFtCObEj+S4C113p+UZCpJjDCnhMc=; b=jJoTsV5wxXhrDA7ETHBz4flCcCj1jknCO2ZNS5rbpE+aWWKZ6rkEEjBctwvm4uqjkJ CmHQvW1CBXEyd4rtRAbKdLv+Tl0IKW0dYwWARN5HALPrkYUq8DIVoNZn2dSXD7PvL1K2 oKfykAraQQ+o0Aqln5YQ1wbnQzp7claKNvVLQdO55IVFBDjI1Z9snQ8DXxE4pD1gSDcY iHsIEiBlcT7OBdHgfmrKpPYBzddRdeEI5wxNnGpPAW082+M5JTkQO6dEAfrq8ZDjJ10c RnRLODBKk2cdOAignq49SMxBhI8I77mPpNTqIzXcDDIz8XHmsIWkIwOHQRyliG5eJmVF 5BMQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si2337243jam.103.2021.08.17.03.38.00; Tue, 17 Aug 2021 03:38:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239580AbhHQKgs (ORCPT + 99 others); Tue, 17 Aug 2021 06:36:48 -0400 Received: from mail.ispras.ru ([83.149.199.84]:32874 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235845AbhHQKgl (ORCPT ); Tue, 17 Aug 2021 06:36:41 -0400 Received: from hellwig.intra.ispras.ru (unknown [10.10.2.182]) by mail.ispras.ru (Postfix) with ESMTPSA id 7AB0E40A2BD5; Tue, 17 Aug 2021 10:36:03 +0000 (UTC) Subject: Re: [PATCH] mtd: rawnand: mxic: Enable and prepare clocks in probe To: Miquel Raynal , Andy Shevchenko Cc: Richard Weinberger , Vignesh Raghavendra , Kirill Shilimanov , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "ldv-project@linuxtesting.org" References: <20210812113800.12466-1-novikov@ispras.ru> <20210816100114.384f01b9@xps13> From: Evgeny Novikov Message-ID: <246f2094-e294-73f8-8a5f-3467e987f788@ispras.ru> Date: Tue, 17 Aug 2021 13:36:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210816100114.384f01b9@xps13> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, On 16.08.2021 11:01, Miquel Raynal wrote: > Hi Andy, > > Andy Shevchenko wrote on Thu, 12 Aug 2021 > 15:13:10 +0300: > >> On Thursday, August 12, 2021, Evgeny Novikov wrote: >> >>> It seems that mxic_nfc_probe() missed invocation of >>> mxic_nfc_clk_enable(). The patch fixed that. In addition, error handling >>> was refined appropriately. >> >> NAK. Until you provide a deeper analysis, like how this works before your >> change. >> >> >> Please, don’t blindly generate patches, this can even your bot do, just >> think about each change and preferable test on the real hardware. >> >> The above is to all your lovely contributions. >> >> >>> Found by Linux Driver Verification project (linuxtesting.org). >>> >>> Signed-off-by: Evgeny Novikov >>> Co-developed-by: Kirill Shilimanov >>> Signed-off-by: Kirill Shilimanov >>> --- >>> drivers/mtd/nand/raw/mxic_nand.c | 16 ++++++++++++---- >>> 1 file changed, 12 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_ >>> nand.c >>> index da1070993994..37e75bf60ee5 100644 >>> --- a/drivers/mtd/nand/raw/mxic_nand.c >>> +++ b/drivers/mtd/nand/raw/mxic_nand.c >>> @@ -509,9 +509,15 @@ static int mxic_nfc_probe(struct platform_device >>> *pdev) >>> if (IS_ERR(nfc->send_dly_clk)) >>> return PTR_ERR(nfc->send_dly_clk); >>> >>> + err = mxic_nfc_clk_enable(nfc); >>> + if (err) >>> + return err; > As Andy said, this is not needed. > >>> + >>> nfc->regs = devm_platform_ioremap_resource(pdev, 0); >>> - if (IS_ERR(nfc->regs)) >>> - return PTR_ERR(nfc->regs); >>> + if (IS_ERR(nfc->regs)) { >>> + err = PTR_ERR(nfc->regs); >>> + goto fail; >>> + } >>> >>> nand_chip = &nfc->chip; >>> mtd = nand_to_mtd(nand_chip); >>> @@ -527,8 +533,10 @@ static int mxic_nfc_probe(struct platform_device >>> *pdev) >>> nand_chip->controller = &nfc->controller; >>> >>> irq = platform_get_irq(pdev, 0); >>> - if (irq < 0) >>> - return irq; >>> + if (irq < 0) { >>> + err = irq; >>> + goto fail; > However some reworking is needed in the error path. > > That goto statement should be renamed and devm_request_irq() should not > jump to it. > We still need some help and clarification from those who are very familiar with this sort of drivers or/and can test this particular driver. mxic_nfc_clk_enable() is the complementary function for mxic_nfc_clk_disable(). No other functions invoke clk_prepare_enable()/clk_disable_unprepare() in the driver. Unlikely somebody in its environment does that since driver specific clocks are dealt with. At the moment the driver invokes mxic_nfc_clk_disable() on error handling paths in probe, in remove and in mxic_nfc_set_freq(). mxic_nfc_clk_enable() is called just by mxic_nfc_set_freq() that moreover does this after calling mxic_nfc_clk_disable() first. So, we did not find any place in the driver that invokes mxic_nfc_clk_enable() prior to mxic_nfc_clk_disable(). Basing on this we added mxic_nfc_clk_enable() just after getting clocks. As I explained in the previous large e-mail, we may be wrong in our understanding of the driver environment or/and at specification of requirements being checked. It would be great if you will point out on our mistakes. Best regards, Evgeny Novikov >>> + } >>> >>> mxic_nfc_hw_init(nfc); >>> >>> -- >>> 2.26.2 >>> >>> > Thanks, > Miquèl