Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2231262yba; Thu, 25 Apr 2019 12:51:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXutcRSfMJwJ7r7PPmmkjTPtdlPSg9EcJGI2YQZ6rqG+DhRjV4amCfRq062HVWLsvtHuhk X-Received: by 2002:a17:902:8c89:: with SMTP id t9mr42368445plo.265.1556221889617; Thu, 25 Apr 2019 12:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556221889; cv=none; d=google.com; s=arc-20160816; b=BVo4JyKh32QeCv0UQ5ANpmTvs7GA0yA3SgajjM3TxeoNyIUlUHKW+8juvGk/qupmXS Go+Phiamn/jcCQoMTFL9VtQ4+BXxRAsr5fkoHBQXHmeuiQOr+0dukhOSjK8bU7VIDwby yxDTpnUD2Y0EJvZfnJzFYJIG4UB5JX9zba8ax5mYgpWAXdi+hIVB8W9tE8UUb5lWOnK1 nX+Ti8mhMPGMTmPX8JVoM5PsFs5qYeq/AFtDKHb1tiJ//C0gHihKVpSSfYQfY71m48IT uv96asyzHkRSlOFSU2R6FpTZfuSfaD/t3fm66tIx555YwU7O+/NNkUjWVLQm4scNVi/f Yw9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=08teZNw38rfvRljqt/Q1KqrLnoqeOGqaGzzRUPMCiG0=; b=znKWiX3zPwiJHtzKJmUWHkQkt0chEfe172tsxW0v0K0R6aQsziomr8fko6n4taYGBV j8n7qHv1Bub1LopNFrkF0RDsscmQ0QGQ5q48fFBJGJ0K1sjo8L5oQhX4ZNEfC6OR1omz FMjtVz4a/qDvChEGN4yNGMlKhurCvlbcIZKYgpLzEaJCV31o/4WravJlrF2HvCvYvoln hGSbHztFSaWTzl0E9sudkk5GJBJA+0HyvpHb4oTF2Cmk8nFtHVa0cqJHXSLdPMCRAU4Y hv8a84Ii8Pqw3s5ZF6K7wY8AJENsKgms+lq59tigK4IUxD2ncDI+v+yc4PW+XHrwA4MH qNdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OZLq+uyx; 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 m63si23800463pld.147.2019.04.25.12.51.14; Thu, 25 Apr 2019 12:51:29 -0700 (PDT) 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=OZLq+uyx; 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 S1730519AbfDYTtt (ORCPT + 99 others); Thu, 25 Apr 2019 15:49:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfDYTtt (ORCPT ); Thu, 25 Apr 2019 15:49:49 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 A6711206BF; Thu, 25 Apr 2019 19:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556221789; bh=5+UzOGZVxGDsNphbonQceRHhUCczCcg9VVkdUolF98k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OZLq+uyxlePppjoXloRfx0bLLnG0lL45KuktDHBi/j41RbYZGXDBCVz2S16U2BhzE j2vCSvFhMFWcWQ4ASX4bRjY0KL8q0GwBaqSRYsw6OeWgNksV0apT2fdoTSPYtDR3d1 CW9RjecOFoBarLwW8X9S2jF5fF/j5cSdR3eXksOo= Date: Thu, 25 Apr 2019 21:49:46 +0200 From: Greg KH To: Chengguang Xu Cc: dan.carpenter@oracle.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] chardev: set variable ret to -EBUSY before checking minor range overlap Message-ID: <20190425194946.GA15196@kroah.com> References: <20190405135306.10188-1-cgxu519@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190405135306.10188-1-cgxu519@gmx.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 05, 2019 at 09:53:06PM +0800, Chengguang Xu wrote: > When allocating dynamic major, the minor range overlap check > in __register_chrdev_region() will not fail, so actually > there is no real case to passing non negative error code to > caller. However, set variable ret to -EBUSY before chekcking > minor range overlap will avoid false-positive warning from > code analyzing tool(like Smatch) and also make the code more > easy to understand. > > Suggested-by: Dan Carpenter > Signed-off-by: Chengguang Xu > --- > fs/char_dev.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) What tree was this patch made against? I can't seem to apply it anywhere :( Please fix up and resend. thanks, greg k-h