Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp970304pxb; Fri, 22 Apr 2022 15:37:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhgNi9X03Af9WNt81kE9VXE1Ci7Qxn9XZsSCy51Fs5nbte7nZWWwCjlH54GcIX/B18zGof X-Received: by 2002:a17:90b:180f:b0:1d2:d217:6373 with SMTP id lw15-20020a17090b180f00b001d2d2176373mr19072433pjb.161.1650667045356; Fri, 22 Apr 2022 15:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650667045; cv=none; d=google.com; s=arc-20160816; b=AUIPNLzxM6fEJawCi0LdNwoULrWtg4SiFP7bcSqtTLcZRwsLyc4HouHhvyMKAVhyOD mFYHJqi7luY0v7vYjLnPP6JTTjWgTY1P2gTiH8XKUjO+8R0rdGsgIy+VV3HQHnzaFkGe KmWaWeGqT99qig5Yb1D4ZA/yG/I9tnlh1dwCh54u39omX0l1XX8CwIYpt7/LBN8NMXqp IcNdFT0jcs2QgdvDAyQJqhKu3rSzTK74a8hovSWpo2B8hKNzI85l2lQ33f2/5nlqiizR y1QqYcIhxzRQB+013AIVCtOLFbUIp7GFB0c87t7459kBM2I9oYfPuU595zbB9i/qxPDn MjmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g71afBe03kBYuxiT9CusOK+qbu46m0CphYm7CF5fRTQ=; b=ZBgZ5hTWSE+7I5ZTXZvSjIVlm6KZXx8ml5pzVVAdZuZgGqXjMGJrm+aM5KX45yE19V nPKAUDFUn1iYtXfZfjknrWYmySHcj0jAey/PiijkAKqFuGGt4tFtTraZcoo37XqtEqBD 0FZ5vRXgdkioSBNP8sclkTdzM97bPoMuuYhv84OeweLYAOJy+CE8LARGP+WcFhGAKNkH LHJrWiJFNF0nq0FU5TiLelRi/TuSyU/PtoDpbQn1KV6VSAPDy3nIbYnuldFya/nHsSGx 7LskHUbmOu0m2axgQBIKlbJn+0Q45vcgMYOfcYC5rFw9O413L1LhMjbnQxiRhPS6bK1n qCyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oA7X0J5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 129-20020a630087000000b003816043f054si9300585pga.585.2022.04.22.15.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oA7X0J5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6F2BF3BE55B; Fri, 22 Apr 2022 13:24:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358926AbiDTCYM (ORCPT + 99 others); Tue, 19 Apr 2022 22:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356849AbiDTCYK (ORCPT ); Tue, 19 Apr 2022 22:24:10 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CEDE2C64E; Tue, 19 Apr 2022 19:21:26 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id z16so593263pfh.3; Tue, 19 Apr 2022 19:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g71afBe03kBYuxiT9CusOK+qbu46m0CphYm7CF5fRTQ=; b=oA7X0J5wj1JyA7Pva/Rylb7Gvkt1hdiEl92H4JvGgufP2ViDVvxtwuh8qRawYrpAcy XzFHjcS8ChQdptHrFyA//Ma1wo4UoOXQFCY7PA83PIbVE2h360oSOwhZbeC48vgJNmAa Y9tylgfh/mY4MwcfljQ5q+Id9w2z0z7O0fisqY/Kulu6BMEBLwAEdNC7I+sSr9MCYmEp Q1BigWesesQP9OkmRLHFGeqEFrolFOb1O4MFEDvTTktrgXIc7BTfFfU2WMY4EQ/bV+Gh gHKLWF5R9nus9QwdY5/MMd/iPjVWk2/oMEMT348v1Y4qqCfaMcu7zmV466MJOGh93asZ 1USQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g71afBe03kBYuxiT9CusOK+qbu46m0CphYm7CF5fRTQ=; b=wtzqZgrZN0PjorSqePX8oRmuYTZyvy/BoYBW8maaMCpJOOtISJo3v5wmqq6D+Whzge xPoxiZ+QTgBpFwcGM4MAqOikM4z5jRtuRZ4QlH8euI/SZsVpFv6q2nISQp3gyRfsWdEF vt1tM0xOdiWCsS4PHQAB66+pQb45gEWsOsHSq9OGXjR+GCcVPPN//EYmgYA7ujCu1G25 9k1FYXCwEiWKRhciw2S/BVtPehVNuZhfvEGXzczMwl/M180pA5zzrM/rJSyuy8zx+k57 zOzT7IHs1NFnzDBQNa3aLnayppI9kDq7ivNXz9Tffndumb3y24IFDYA7SAPMpyiWXJNk briA== X-Gm-Message-State: AOAM531iP8LBE49UuZc3KXsbHhiDeau+z1ZIbcEjaNDAIsrwaoqJGdjI wHFaPhGhksCIPRuDX0G29tLGWXApgJ8ZUBrSqQ== X-Received: by 2002:a63:ce45:0:b0:399:1124:fbfe with SMTP id r5-20020a63ce45000000b003991124fbfemr17587195pgi.542.1650421286100; Tue, 19 Apr 2022 19:21:26 -0700 (PDT) MIME-Version: 1.0 References: <05433153-0424-ab66-1573-993d0490c5bc@opensource.wdc.com> <3045fde1-2d5b-e731-ef18-6cf3f0987259@opensource.wdc.com> In-Reply-To: <3045fde1-2d5b-e731-ef18-6cf3f0987259@opensource.wdc.com> From: Zheyu Ma Date: Wed, 20 Apr 2022 10:21:14 +0800 Message-ID: Subject: Re: [BUG] ata: pata_marvell: Warning when probing the module To: Damien Le Moal Cc: Sergey Shtylyov , linux-ide@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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 On Wed, Apr 13, 2022 at 11:42 AM Damien Le Moal wrote: > > On 4/12/22 15:34, Zheyu Ma wrote: > > On Mon, Apr 11, 2022 at 7:53 AM Damien Le Moal > > wrote: > >> > >> On 4/10/22 15:30, Zheyu Ma wrote: > >>> Hello, > >>> > >>> I found a bug in the pata_marvell module. > >>> When probing the driver, it seems to trigger the error path and > >>> executes the function marvell_cable_detect(), but the > >>> 'ap->ioaddr.bmdma_addr' is not initialized, which causes a warning. > >> > >> I do not have this hardware so I cannot debug this. Please debug it and > >> send a patch. bmdma_addr is normally set in ata_pci_bmdma_init(), but some > >> drivers set it manually in their probe functions. No idea about the > >> marvell driver, I have not checked it. > > > > To be honest I don't have a good solution to this problem, because > > other drivers don't have similar behavior. The marvell driver doesn't > > even initialize 'bmdma_addr' before calling 'cable_detect'. > > Then this is the bug that needs to be fixed, no ? > > > So a simple idea I have is to check if 'bmdma_addr' is 0 before > > reading it and if so return the error code ATA_CBL_NONE. > > And if indeed, even after it is initialized it is still 0, then yes, this > change seems sensible. Sorry for the late reply, I found the root cause of this issue. The marvell driver execute the ata_pci_bmdma_init() function, but the driver just returned at the following code snippet. if (pci_resource_start(pdev, 4) == 0) { ata_bmdma_nodma(host, "BAR4 is zero"); return; } So the driver didn't initialize the 'bmdma_addr' but used it in the cable_detect() function. It seems that the problem is caused by the hardware, is this a bug that we should fix? Zheyu Ma Zheyu Ma