From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753436AbbFWG1z (ORCPT ); Tue, 23 Jun 2015 02:27:55 -0400 Received: from a.ns.miles-group.at ([95.130.255.143]:65275 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbbFWG1r (ORCPT ); Tue, 23 Jun 2015 02:27:47 -0400 Message-ID: <5588FC61.5070202@nod.at> Date: Tue, 23 Jun 2015 08:27:45 +0200 From: Richard Weinberger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Brian Norris CC: dwmw2@infradead.org, maximlevitsky@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] mtd: docg3: Don't do ERR_PTR(0) References: <1433193054-26865-1-git-send-email-richard@nod.at> <1433193054-26865-7-git-send-email-richard@nod.at> <20150617184144.GH4917@ld-irv-0074> In-Reply-To: <20150617184144.GH4917@ld-irv-0074> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 17.06.2015 um 20:41 schrieb Brian Norris: > On Mon, Jun 01, 2015 at 11:10:54PM +0200, Richard Weinberger wrote: >> Don't return a obfuscated null pointer using ERR_PTR(0). >> If the no device is found clearly return -ENODEV. >> This makes the code more clear and matches the comment >> of doc_probe_device(). >> >> Signed-off-by: Richard Weinberger >> --- > > Have you tested this patch? nah, I don't own such a device. >> drivers/mtd/devices/docg3.c | 16 ++++++---------- >> 1 file changed, 6 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c >> index 5e67b4a..630e29a 100644 >> --- a/drivers/mtd/devices/docg3.c >> +++ b/drivers/mtd/devices/docg3.c >> @@ -1902,7 +1902,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev) >> chip_id = doc_register_readw(docg3, DOC_CHIPID); >> chip_id_inv = doc_register_readw(docg3, DOC_CHIPID_INV); >> >> - ret = 0; >> + ret = -ENODEV; >> if (chip_id != (u16)(~chip_id_inv)) { >> goto nomem4; >> } >> @@ -2068,13 +2068,10 @@ static int __init docg3_probe(struct platform_device *pdev) >> mtd = doc_probe_device(cascade, floor, dev); >> if (IS_ERR(mtd)) { >> ret = PTR_ERR(mtd); >> - goto err_probe; >> - } >> - if (!mtd) { >> - if (floor == 0) >> - goto notfound; >> - else >> + if (ret == -ENODEV && floor == 0) > > I think you might have changed the logic when refactoring here. I think > the right refactoring would be the following, no? > > if (ret == -ENODEV && floor != 0) > continue; > else > goto err_probe; > You are right, the logic changed. ;-\ Please drop this patch, I'll resend it for 4.3. Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/