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 DF0CBC433F5 for ; Mon, 1 Nov 2021 09:25:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7AFE61267 for ; Mon, 1 Nov 2021 09:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232250AbhKAJ1h (ORCPT ); Mon, 1 Nov 2021 05:27:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:59012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232695AbhKAJY3 (ORCPT ); Mon, 1 Nov 2021 05:24:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF361611C3; Mon, 1 Nov 2021 09:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758485; bh=PxT3P/1GWZV5y+OBZFeo7AiK/tT5JhpmtqDJQKyf3lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtRS+MKNVVFrCRszvFCIdEgBX9xr+QiCXkUwQtIvwpzmtFzVq8v+rUnN0fMMfFJ9M dF+Z8RkQugLfAa11R7jbtbHDD8QwTXk0Tov+A9r04ZBnYLBBsEfJOpT8zx79Hrq7gJ P33EL+qOvJL9znJ4TAKn5BreynMHQ1tntVm/xBms= 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.19 10/35] ata: sata_mv: Fix the error handling of mv_chip_id() Date: Mon, 1 Nov 2021 10:17:22 +0100 Message-Id: <20211101082454.010259907@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082451.430720900@linuxfoundation.org> References: <20211101082451.430720900@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 @@ -3905,8 +3905,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;