Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757145AbbEVOWA (ORCPT ); Fri, 22 May 2015 10:22:00 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:26565 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756620AbbEVOV5 (ORCPT ); Fri, 22 May 2015 10:21:57 -0400 Message-ID: <555F3B7B.20500@oracle.com> Date: Fri, 22 May 2015 10:21:47 -0400 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Heikki Krogerus CC: "Lu, Baolu" , David Cohen , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, balbi@ti.com Subject: Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist References: <1432150406-20550-1-git-send-email-sasha.levin@oracle.com> <20150520212235.GA20943@psi-dev26.jf.intel.com> <555D7DB4.6030606@linux.intel.com> <20150521072133.GA16847@kuha.fi.intel.com> <20150522101637.GB26704@kuha.fi.intel.com> In-Reply-To: <20150522101637.GB26704@kuha.fi.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1405 Lines: 36 On 05/22/2015 06:16 AM, Heikki Krogerus wrote: >>>>> diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c >>>>> > > >>index 0e6f968..0b0a5e7 100644 >>>>> > > >>--- a/drivers/usb/common/ulpi.c >>>>> > > >>+++ b/drivers/usb/common/ulpi.c >>>>> > > >>@@ -132,6 +132,10 @@ int ulpi_register_driver(struct ulpi_driver *drv) >>>>> > > >> if (!drv->probe) >>>>> > > >> return -EINVAL; >>>>> > > >>+ /* Was the bus registered successfully? */ >>>>> > > >>+ if (!ulpi_bus.p) >>>>> > > >>+ return -ENODEV; >> > >> > I think we need to warn in this case. How about: >> > >> > if (unlikely(WARN_ON(!ulpi_bus.p))) No, please, the bus just doesn't exist - there's nothing wrong with that and there's no reason to trigger an alarm for the user. Nothing out of the ordinary happened here and the return value should be enough to tell the user what's up. This will cause a perma-WARN for folks who have that bus built in but don't actually have it on their system. >> > return -ENODEV; > I think we should also return -EAGAIN here. EAGAIN? For when a bus doesn't exist? How would a user retrying fix the issue? Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/