Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp28962rdb; Wed, 29 Nov 2023 18:42:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/ucYhzwpGoA4GFH6foLA3YCxTakvxN25w4gYT1fbG79jbHujYnvf9TYvMGyNk6p1oJ13C X-Received: by 2002:a17:90b:4b8f:b0:286:2e71:1392 with SMTP id lr15-20020a17090b4b8f00b002862e711392mr2626173pjb.9.1701312175446; Wed, 29 Nov 2023 18:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701312175; cv=none; d=google.com; s=arc-20160816; b=oAgFSs53orHiBQDft99d7IxTNXt1iFrnUdhhGwQtSkmZPottWiVCf4xbk1ENkY2L8V RfHoxmsBtIuvxDYzEnmT+xZdX9yC7nc2iJP2M2m8pR03Y/HdVUmmqV30vkuRpnmh7FQ/ 955gcgkV8m7/9qhvfeg/w00LK2KyoDYpqILFfG94G5SsqKW0htcRx8v/6C7A5/V8+mjq 4b6iGPd6g9XMmp12uZWBDwBbZqWGyV1f6pexLfzw3d+Wp4YkryB8GT/mpNcn3blwU41w F0af4wBA8U01/TU3fcGzstS+zI1uz99K2aq46taqOV04BXovUTQfy0ovvM1oUCqIw9bu Cyeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=MtAC3+fuOFMryxnsPCVLXAyNn2h16sbt+wYSk5eX05k=; fh=9eAMU4jhnPf0EWSp2WyIiPLC+7rWuzfCRyFFSbdUo6U=; b=zaLENgMTUb9kT1W39rxuEQWcSAIDvbgZOjydyYI+ovJrOYPZ+oX7m3+Z+0mAyrUPE8 uyGAz68Wj/CL+OQgE6CSFTYGOQx2KhVV+2R+nlkAwt0WqxQU0CzdAk2Y3Y0PXk+u0P9f E9+o2by/2GOibRvTlTlz1fB0kSb7cdBtzkPOOFl5pVug1MQmiGTIco6QtDv3UU32W4Bd 9B1Z9+ZIaH+i1kB4k+GryHFLv7fXTeQwrdT5UI6dcjUgyoty4YNJx0z/f8ZKej8zPexz cuIF8X6NLehzyfGfbMnQyrvp6yjrbyIrBpjuBnitKymjiSzr+X9W9fogAqVymqKxNEUG tTMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y21-20020a17090ad71500b00285a62cc148si2553155pju.134.2023.11.29.18.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 18:42:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 721AE8034174; Wed, 29 Nov 2023 18:42:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344186AbjK3Cm0 (ORCPT + 99 others); Wed, 29 Nov 2023 21:42:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344387AbjK3CmA (ORCPT ); Wed, 29 Nov 2023 21:42:00 -0500 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 09BF110E3; Wed, 29 Nov 2023 18:42:04 -0800 (PST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 09CE860DF8F3F; Thu, 30 Nov 2023 10:41:48 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: 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] scsi: aic7xxx: fix some problem of return value Date: Thu, 30 Nov 2023 10:41:23 +0800 Message-Id: <20231130024122.1193324-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 29 Nov 2023 18:42:52 -0800 (PST) aic7770_probe() should return negative error code rather than positive. However, aic7770_config() only return positive error code, ahc_linux_register_host() return both positive and negative error code. Make aic7770_probe() return negative if error happened and let ahc_linux_register_host() only return positive error code to fix this problem. ahc_linux_pci_dev_probe() should return the value of ahc_linux_register_host() rather than zero. Signed-off-by: Su Hui --- drivers/scsi/aic7xxx/aic7770_osm.c | 8 ++++---- drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 +- drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index bdd177e3d762..3c1aca15d956 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c @@ -87,23 +87,23 @@ aic7770_probe(struct device *dev) sprintf(buf, "ahc_eisa:%d", eisaBase >> 12); name = kstrdup(buf, GFP_ATOMIC); if (name == NULL) - return (ENOMEM); + return -ENOMEM; ahc = ahc_alloc(&aic7xxx_driver_template, name); if (ahc == NULL) - return (ENOMEM); + return -ENOMEM; ahc->dev = dev; error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, eisaBase); if (error != 0) { ahc->bsh.ioport = 0; ahc_free(ahc); - return (error); + return -error; } dev_set_drvdata(dev, ahc); error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); - return (error); + return -error; } static int diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 4ae0a1c4d374..158aaeca8941 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -1117,7 +1117,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa if (retval) { printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); scsi_host_put(host); - return retval; + return -retval; } scsi_scan_host(host); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index a07e94fac673..e17eb8df12c4 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -241,8 +241,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ahc_linux_pci_inherit_flags(ahc); pci_set_drvdata(pdev, ahc); - ahc_linux_register_host(ahc, &aic7xxx_driver_template); - return (0); + error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); + return -error; } /******************************* PCI Routines *********************************/ -- 2.30.2