From nobody Tue Dec 16 11:50:03 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71E7BC4167B for ; Fri, 1 Dec 2023 03:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377048AbjLADAU (ORCPT ); Thu, 30 Nov 2023 22:00:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbjLADAQ (ORCPT ); Thu, 30 Nov 2023 22:00:16 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 97A2B171D; Thu, 30 Nov 2023 19:00:21 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 976C760105E65; Fri, 1 Dec 2023 11:00:18 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: dan.carpenter@linaro.org, hare@suse.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: Su Hui , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2 1/3] scsi: aic7xxx: return negative error codes in ahc_linux_register_host() Date: Fri, 1 Dec 2023 10:59:54 +0800 Message-Id: <20231201025955.1584260-2-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231201025955.1584260-1-suhui@nfschina.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ahc_linux_register_host() return both positive and negative error code, it's better to make this function only return negative error codes. Signed-off-by: Su Hui Reviewed-by: Dan Carpenter --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7= xxx_osm.c index 4ae0a1c4d374..b0c4f2345321 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1085,7 +1085,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct= scsi_host_template *templa template->name =3D ahc->description; host =3D scsi_host_alloc(template, sizeof(struct ahc_softc *)); if (host =3D=3D NULL) - return (ENOMEM); + return -ENOMEM; =20 *((struct ahc_softc **)host->hostdata) =3D ahc; ahc->platform_data->host =3D host; --=20 2.30.2 From nobody Tue Dec 16 11:50:03 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06141C4167B for ; Fri, 1 Dec 2023 03:00:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377025AbjLADAS (ORCPT ); Thu, 30 Nov 2023 22:00:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjLADAQ (ORCPT ); Thu, 30 Nov 2023 22:00:16 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 10D881720; Thu, 30 Nov 2023 19:00:21 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 222D560105E64; Fri, 1 Dec 2023 11:00:20 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: dan.carpenter@linaro.org, hare@suse.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: Su Hui , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2 2/3] scsi: aic7xxx: return ahc_linux_register_host()'s value rather than zero Date: Fri, 1 Dec 2023 10:59:55 +0800 Message-Id: <20231201025955.1584260-3-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231201025955.1584260-1-suhui@nfschina.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ahc_linux_register_host() can return error code if failed. So ahc_linux_pci_dev_probe() should return the value of ahc_linux_register_host() rather than zero. And the last patch made ahc_linux_register_host() return negative error codes, which makes sure ahc_linux_pci_dev_probe() returns negative error codes. Signed-off-by: Su Hui Reviewed-by: Dan Carpenter --- drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/= aic7xxx_osm_pci.c index a07e94fac673..198440dc0918 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -241,8 +241,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const str= uct pci_device_id *ent) ahc_linux_pci_inherit_flags(ahc); =20 pci_set_drvdata(pdev, ahc); - ahc_linux_register_host(ahc, &aic7xxx_driver_template); - return (0); + return ahc_linux_register_host(ahc, &aic7xxx_driver_template); } =20 /******************************* PCI Routines ****************************= *****/ --=20 2.30.2 From nobody Tue Dec 16 11:50:03 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5C0C10DCE for ; Fri, 1 Dec 2023 03:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377078AbjLADAW (ORCPT ); Thu, 30 Nov 2023 22:00:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376922AbjLADAS (ORCPT ); Thu, 30 Nov 2023 22:00:18 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 0F9CE1722; Thu, 30 Nov 2023 19:00:23 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 6E5CF60105E65; Fri, 1 Dec 2023 11:00:21 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: dan.carpenter@linaro.org, hare@suse.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: Su Hui , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2 3/3] scsi: aic7xxx: return negative error codes in aic7770_probe() Date: Fri, 1 Dec 2023 10:59:56 +0800 Message-Id: <20231201025955.1584260-4-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231201025955.1584260-1-suhui@nfschina.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" aic7770_config() returns both negative and positive error code. it's better to make aic7770_probe() only return negative error codes. And the previous patch made ahc_linux_register_host() return negative error codes, which makes sure aic7770_probe() returns negative error codes. Signed-off-by: Su Hui Reviewed-by: Dan Carpenter --- drivers/scsi/aic7xxx/aic7770_osm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7= 770_osm.c index bdd177e3d762..a19cdd87c453 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c @@ -87,17 +87,17 @@ aic7770_probe(struct device *dev) sprintf(buf, "ahc_eisa:%d", eisaBase >> 12); name =3D kstrdup(buf, GFP_ATOMIC); if (name =3D=3D NULL) - return (ENOMEM); + return -ENOMEM; ahc =3D ahc_alloc(&aic7xxx_driver_template, name); if (ahc =3D=3D NULL) - return (ENOMEM); + return -ENOMEM; ahc->dev =3D dev; error =3D aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, eisaBase); if (error !=3D 0) { ahc->bsh.ioport =3D 0; ahc_free(ahc); - return (error); + return error < 0 ? error : -error; } =20 dev_set_drvdata(dev, ahc); --=20 2.30.2