Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp586111imu; Wed, 23 Jan 2019 01:55:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN46hUQnsxq6OCOLjD/LKE7J8KzPFS0Hn/LzHA8st7xUcPUOa7tysdMUtaf3Nyfy80Mh0Gn1 X-Received: by 2002:aa7:810c:: with SMTP id b12mr1461482pfi.44.1548237348961; Wed, 23 Jan 2019 01:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548237348; cv=none; d=google.com; s=arc-20160816; b=H5UU72jhca5UWxZFl9QtHpNMmsjw4hleHyNiQr0nCUOP+jnyT0bc2Z1B9AT716FlPK CCUwGZbfi6EJf46wo+PH+cnVTzDLb6wI49wcDI6hPuqidpHi8E1ermPxijas/GwFxUEL Oo1L3H4ixxoFPITbKhspg/y1nloIb9jrFsYNknydB468JK+Uw9CG7C/xeD853IfbhQkx WFlPr/41SkH6I9gZZEenRwFVcl7PLEGaPLJxIMblP20OQE9ALl1JyZdD40NtHhXaxzDj NPB2FX4WpgEYeEoVYVYofhZWK4MwYdxVlrQu/tCH5k4aSmPgLfhLo2+jqLaB/KDpEsh9 gwZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SHGCF7nrl8Ozy+CqxN7Y3AH0aEYwVKRLHB97/+Iy5Yg=; b=onjeG6/FdA+9P3AJ1keuEW+VHIB31GGlIPNbg+nkQdCdKm9gG6exlPAO3cWDVDDulN vkhhah6e/UmI39EgBRqoNQF51rPhEaLYgJL+PtZuHuLafEonvYl/o3gOViJTTdD0cbne mKTpsFUgGXbds3QQ/kqKCnGmGiUxj4Nd0MJjjdiCCeZ56QaLY5xkA+LKYr2MitgOXjZJ Pv5/14pvd4geO2LvfQiNXM53IW5iYg5YOBiNsQU6uinBk6IOTaptbtmZzPRv//FGHG2j n7A4wJETUCbJ1cfazxvA9NbGgvi/gQw4WLEC0sLPn7iR4ks0DYPpMWFYFf8ZY9Aou813 E6+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AAOQb4aL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si17216032plo.363.2019.01.23.01.55.33; Wed, 23 Jan 2019 01:55:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b=AAOQb4aL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbfAWJxF (ORCPT + 99 others); Wed, 23 Jan 2019 04:53:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:51594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbfAWJxD (ORCPT ); Wed, 23 Jan 2019 04:53:03 -0500 Received: from bbrezillon (unknown [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8D22220861; Wed, 23 Jan 2019 09:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548237182; bh=HF9eJMFJxhcLLoRHjywiWFMXig3DHPntZ6ReryupSo4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AAOQb4aL46H8730kX9v8dQYrlcrWKckmvMVuCxONgxV1uj7voN9aChjhPj3+lsUKS c+wSCwluwefmmiIER48K8je53BT9nk+1LXOmQ+YoV6k3eyWxDPyeIuniZ1KKpNS/ts B/7H/E0voNVMlPBfZe44gXjjtd+wgPXFklpfEP+g= Date: Wed, 23 Jan 2019 10:52:53 +0100 From: Boris Brezillon To: YueHaibing Cc: , , , , , , Subject: Re: [PATCH -next] mtd: docg3: Fix passing zero to 'PTR_ERR' warning in doc_probe_device Message-ID: <20190123105253.1f4487f2@bbrezillon> In-Reply-To: <86533285-e800-5cc0-f495-88fff8326b5a@huawei.com> References: <20190123065827.16748-1-yuehaibing@huawei.com> <20190123101253.243add9d@bbrezillon> <86533285-e800-5cc0-f495-88fff8326b5a@huawei.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.