Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1219042imu; Wed, 23 Jan 2019 12:50:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN4UqvxruO5u42rSwjToBAzMZ0IdlAoluZbDx8/RFK5+mGyyNFDf+rZm7umSaLHUwz2N+Tri X-Received: by 2002:a62:e0d8:: with SMTP id d85mr3507767pfm.214.1548276607482; Wed, 23 Jan 2019 12:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548276607; cv=none; d=google.com; s=arc-20160816; b=wuVMe4EHIlWFku3h2hvODfa5R3AH43RvTV+x5vpdH1sFaPczNSKqWwiJ3bvAyFher3 3wMVCF2xYGB+0puGAHcy2d+UGPjVd4W+PdguN4mfknqsf+9OjUiVpmGWYSbYVwi/uMJ9 jRojZXEnFEbixvHQxO3UpY5A21cwoNURM7KO2G/tABC8GzU2tvsCroWIRVpwPZMTKH4S nybZSI6/Sy/bGPgr07WiZcOeI/yAhkzCkij1ayEELgNsUZhCRN37rKCoeiq8YvQGETgr suQiDPB9kGngDp3l2iuwb6b7R2teoG66LoAALWQdU7J0mGBTYaecmH5YVeOgAPcFrn2z txfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=UoRBdOaNYCUwhM4bkpX3vIZMrKToPowKA6bbezygvCI=; b=NZJfqCFaOs2Uz53OEsIBHZ+KRjdAqfdhJyDY/we/9L+9gJvOJfKquJiSYjqqOC5Xaf Utg5CNgnnJIzrEsD23oHq5zFdS0y7oySLa99tPD6xvo7Euf1Dn5U5XClNBTdHtVuLuyU o4FUTqsZdRcAqY7cplTJlurGGosdaK5bIZEuhwQK+mMrZM1a4DeVyv907FPcSuWTe/RC GQkvdZJdyfra5xm6AT8pAMYEWXo4uk7iUv2DdsaOAQaKwYa3VCt2sIMjqnTBGP4DAGtq NB+UJ3wYAbHRSPfwHzIPBSyZQpngexgMfY8lGKQs6CAkdFYE0U0X32xszAkHqVYK11xD X6AQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16si19587387plm.365.2019.01.23.12.49.51; Wed, 23 Jan 2019 12:50:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbfAWUt2 (ORCPT + 99 others); Wed, 23 Jan 2019 15:49:28 -0500 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:44929 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbfAWUt2 (ORCPT ); Wed, 23 Jan 2019 15:49:28 -0500 Received: from belgarion ([86.206.19.74]) by mwinf5d65 with ME id TwpF1z0071btlZA03wpNuL; Wed, 23 Jan 2019 21:49:24 +0100 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Wed, 23 Jan 2019 21:49:24 +0100 X-ME-IP: 86.206.19.74 From: Robert Jarzmik To: Boris Brezillon Cc: YueHaibing , , , , , , Subject: Re: [PATCH -next] mtd: docg3: Fix passing zero to 'PTR_ERR' warning in doc_probe_device References: <20190123065827.16748-1-yuehaibing@huawei.com> <20190123101253.243add9d@bbrezillon> <86533285-e800-5cc0-f495-88fff8326b5a@huawei.com> <20190123105253.1f4487f2@bbrezillon> X-URL: http://belgarath.falguerolles.org/ Date: Wed, 23 Jan 2019 21:49:15 +0100 In-Reply-To: <20190123105253.1f4487f2@bbrezillon> (Boris Brezillon's message of "Wed, 23 Jan 2019 10:52:53 +0100") Message-ID: <87va2fyu9g.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/26 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Boris Brezillon writes: > On Wed, 23 Jan 2019 17:43:58 +0800 > YueHaibing wrote: > >> On 2019/1/23 17:12, Boris Brezillon wrote: >> > On Wed, 23 Jan 2019 14:58:27 +0800 >> > YueHaibing wrote: >> > >> >> Fix a static code checker warning: >> >> drivers/mtd/devices/docg3.c:1875 >> >> doc_probe_device() warn: passing zero to 'ERR_PTR' >> >> >> >> Fixes: ae9d4934b2d7 ("mtd: docg3: add multiple floor support") >> >> Signed-off-by: YueHaibing >> >> --- >> >> drivers/mtd/devices/docg3.c | 2 +- >> >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> >> >> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c >> >> index 4c94fc0..60ddc38 100644 >> >> --- a/drivers/mtd/devices/docg3.c >> >> +++ b/drivers/mtd/devices/docg3.c >> >> @@ -1872,7 +1872,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev) >> >> nomem2: >> >> kfree(docg3); >> >> nomem1: >> >> - return ERR_PTR(ret); >> >> + return ret ? ERR_PTR(ret) : NULL; >> >> } >> >> >> > >> > This is not the right fix, you should instead set ret to -EINVAL: >> >> Thanks , will fix it in v2. >> >> And seems doc_probe_device cannot return NULL. The NULL check of doc_probe_device >> in docg3_probe also can been removed, right? > > Hm, looks like the ret = 0 was intentional (to identify when ID is > invalid). Let's just keep your initial patch. Indeed, that's for the multiple floor configuration if I remember correctly. Acked-by: Robert Jarzmik Cheers. -- Robert