From: Marion & Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Su Hui <suhui@nfschina.com>,
dan.carpenter@linaro.org, hare@suse.com, jejb@linux.ibm.com,
martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2 3/3] scsi: aic7xxx: return negative error codes in aic7770_probe()
Date: Sun, 3 Dec 2023 11:36:00 +0100 [thread overview]
Message-ID: <eb13fc84-d1e8-4121-8569-cf405a35e721@wanadoo.fr> (raw)
In-Reply-To: <87d394e4-e290-41a6-aaf2-92cf6b5ad919@wanadoo.fr>
Le 03/12/2023 à 11:34, Christophe JAILLET a écrit :
> Le 01/12/2023 à 03:59, Su Hui a écrit :
>> 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 <suhui@nfschina.com>
>> ---
>> 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/aic7770_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 = kstrdup(buf, GFP_ATOMIC);
>> if (name == NULL)
>> - return (ENOMEM);
>> + return -ENOMEM;
>> ahc = ahc_alloc(&aic7xxx_driver_template, name);
>> if (ahc == NULL)
>
> Unrelated to your fix, but 'name' is leaking here.
Oups, no, ahc_alloc() handles it.
Really strange API!
CJ
>
> Also, kasprintf() could be used to avoid buf+sprintf()+kstrdup()
>
> The GFP_ATOMIC in the allocation could certainly also be just a GFP_KERNEL.
>
> CJ
>
>> - 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 < 0 ? error : -error;
>> }
>> dev_set_drvdata(dev, ahc);
>
>
next prev parent reply other threads:[~2023-12-03 10:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 2:59 [PATCH v2 0/3] scsi: aic7xxx: fix some problem of return value Su Hui
2023-12-01 2:59 ` [PATCH v2 1/3] scsi: aic7xxx: return negative error codes in ahc_linux_register_host() Su Hui
2023-12-01 2:59 ` [PATCH v2 2/3] scsi: aic7xxx: return ahc_linux_register_host()'s value rather than zero Su Hui
2023-12-01 2:59 ` [PATCH v2 3/3] scsi: aic7xxx: return negative error codes in aic7770_probe() Su Hui
2023-12-03 10:34 ` Christophe JAILLET
2023-12-03 10:36 ` Marion & Christophe JAILLET [this message]
2023-12-01 7:53 ` [PATCH v2 0/3] scsi: aic7xxx: fix some problem of return value Dan Carpenter
2023-12-05 3:33 ` Su Hui
2023-12-05 8:14 ` Dan Carpenter
2023-12-05 8:28 ` Su Hui
2023-12-06 2:18 ` Martin K. Petersen
2023-12-14 4:29 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb13fc84-d1e8-4121-8569-cf405a35e721@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=dan.carpenter@linaro.org \
--cc=hare@suse.com \
--cc=jejb@linux.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=suhui@nfschina.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®