Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp648129rdb; Fri, 26 Jan 2024 06:48:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEB47+wvcdqNq/TGeDnnK/dmfWTe9FuwkScUrJTdX2RLlMKDyGTMdfaZ4f9Hm89oq92FFrs X-Received: by 2002:a05:6a20:938d:b0:19c:600a:1924 with SMTP id x13-20020a056a20938d00b0019c600a1924mr1449220pzh.25.1706280490630; Fri, 26 Jan 2024 06:48:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280490; cv=pass; d=google.com; s=arc-20160816; b=e3s03z683aKKoxp6OaLOB49STZaVwj1wwRiv/gFMiM1su5lv+pcYot6TDF62Su/+Pu yR2vSTfYrUBhkqj7o7Od6vRPHyyWZIvhBZhiDO9K3SKpMGiqnaoYg0x6Zzzm7kyJFwKI 9kq1zT3Clxb+O2KaVg6ignkbYgV4m+lGO2STPRZpkTWHQWotvGmfpBsmAIqch3VDHFk3 VovAT55b/rmH82TlQhFO2/BAnpCV30I31GQNLf1637PHjcRJCaOCCQu6WdaXyDPR1nyF c2PXE5Z9dWBCaBfyzRjf0t0F/ScHD16/jMbw2SvYeR8oCbjCrdBqku7Uxdl8A48uJ/Uu hiBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=eP5nv54sgCIL5hZizBZ/Ry19NDFJ/e051csgIkS0k+g=; fh=XDJKmtIiScP1u8odqnB0KNkKogqelyapWeLspYLs1mg=; b=LIeJnDnvHYJLQdV8sQV8+e5g88agIvPnx0PEIpONb/qmYE6izdTKltLa10ZCxa8sGw FQ5p893S2kz+uoCBf0aqglJT/AxvfOL2fMnoQc7hT3vmeUXU3lL92GVkluXw16OO6Vkr zBeeBmx1ZgqW7PQWPR1GZ51mrCanmPxKF4Ale5cZDrF0MIxowkwW+dK7/Tp1Kl20vWhl PJTn5RNttPa4Mo9UsrYiBI1eDpROKGYExx05NHzbgrGuRtU4l2LvUJD8vEwn/0wLdRR7 ggLlvz1MRwiF5/3fMFgOsa5ZAauS79hBdFMbkRdD47PLLROQIUWNyC2JpJVQEZtaD+/u 5ZzA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-40183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m11-20020a62f20b000000b006ddc27ea59csi1280283pfh.64.2024.01.26.06.48.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:48:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-40183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 89D09B278E4 for ; Fri, 26 Jan 2024 14:30:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46DC41C688; Fri, 26 Jan 2024 14:29:52 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id AAABF1BDE0 for ; Fri, 26 Jan 2024 14:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279391; cv=none; b=mMiDecmLStM4sivi+OmXRp+4TOY11SShY4A9lik/ep89Q7rMFb9gu50IUa2F+nWM+WvR89Nc2kl7dHskWJ7qIxDE4/ltMWCh1p2MtxD00bMAdhICjQ7CL5ByTDO6SDucf9ph1z0NSrMqyCmNT89G0ogf8LfGxhLqLCFj1VmZLI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279391; c=relaxed/simple; bh=th1zKaNSdPkD3kmeMrwoKj4+vtw3MMPyjegeZjcjQx0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZDOmLXaEyy/iZQnfwp4Qg3QkxH9FkFVwoQiYdOBnx9WOP+bH9H7ioGb7OXqv5Kb7rOnkdq4Q4QnYAmiRfPvewh1y5c8ntsgubEThpbCw79rCf2G8JvhaRCa/J792ghGKe1a67YyxHqrB9bG75GbQq4wwXOivjrmy6TVcUl4KooU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 281702 invoked by uid 1000); 26 Jan 2024 09:29:41 -0500 Date: Fri, 26 Jan 2024 09:29:41 -0500 From: Alan Stern To: Ingyu Jang Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ysjeon@unist.ac.kr Subject: Re: [PATCH] Remove redundant check for usb_generic_driver_probe() Message-ID: <42b7cfa2-5ebf-4ef3-9890-4633444bad50@rowland.harvard.edu> References: <20240126120313.1362573-1-ingyujang25@unist.ac.kr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240126120313.1362573-1-ingyujang25@unist.ac.kr> On Fri, Jan 26, 2024 at 09:03:13PM +0900, Ingyu Jang wrote: > usb_generic_driver_probe() only returns 0. > Inside this function, there are only errors that are marked as not fatal. > However, drivers/usb/core/driver.c:269 checks > if usb_generic_driver_probe() returns error. > No need to change usb_generic_driver_probe() to return error, > only remove redundant error check. > > Signed-off-by: Ingyu Jang > --- > drivers/usb/core/driver.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index e01b1913d02b..b6274580b7ca 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -266,8 +266,6 @@ static int usb_probe_device(struct device *dev) > > if (udriver->generic_subclass) > error = usb_generic_driver_probe(udev); > - if (error) > - return error; > > /* Probe the USB device with the driver in hand, but only > * defer to a generic driver in case the current USB Don't do this unless you add comments both here _and_ in usb_generic_driver_probe() explaining that the routine never returns anything but 0. Otherwise, some day in the future someone will change the probe routine to make it return an error code, and won't realize that code here needs to be changed too. Better yet, don't make this change at all. It's a trivial matter and it's not on a hot path. Alan Stern