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 90156C433EF for ; Mon, 1 Nov 2021 09:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78D2B610E5 for ; Mon, 1 Nov 2021 09:24:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231271AbhKAJ0d (ORCPT ); Mon, 1 Nov 2021 05:26:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:58580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231946AbhKAJXk (ORCPT ); Mon, 1 Nov 2021 05:23:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 58FAA610F7; Mon, 1 Nov 2021 09:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758452; bh=kApMBtplrYEmFvcFXyx9aO6SMwJEaX86FxI5TNcr8SE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hylzXhwbSUPfKagAbBfZxi/cTqUS23pBC4Q4YPDbyRGAU/9eaOT0QrjY5sbV4jEA4 Sks2poTxOChOkyk5ZK1OhrBQR0Lttwd58FDb8JTuskmAuO7JGGxyVcrelMAHiqMwWx iuAU7P0/RX1DnL8WFUEEuK6GjfdcSCAFcU52SVv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Damien Le Moal Subject: [PATCH 4.14 08/25] ata: sata_mv: Fix the error handling of mv_chip_id() Date: Mon, 1 Nov 2021 10:17:20 +0100 Message-Id: <20211101082448.996722973@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082447.070493993@linuxfoundation.org> References: <20211101082447.070493993@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheyu Ma commit a0023bb9dd9bc439d44604eeec62426a990054cd upstream. mv_init_host() propagates the value returned by mv_chip_id() which in turn gets propagated by mv_pci_init_one() and hits local_pci_probe(). During the process of driver probing, the probe function should return < 0 for failure, otherwise, the kernel will treat value > 0 as success. Since this is a bug rather than a recoverable runtime error we should use dev_alert() instead of dev_err(). Signed-off-by: Zheyu Ma Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- drivers/ata/sata_mv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -3907,8 +3907,8 @@ static int mv_chip_id(struct ata_host *h break; default: - dev_err(host->dev, "BUG: invalid board index %u\n", board_idx); - return 1; + dev_alert(host->dev, "BUG: invalid board index %u\n", board_idx); + return -EINVAL; } hpriv->hp_flags = hp_flags;