Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21773814ybl; Mon, 6 Jan 2020 10:59:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzpXGk4dul+R8zoGSIOj+nyQu09V+ZWIOl8OVrjH8Ys31HO9B3YezCWfyMyWAncE/89KRid X-Received: by 2002:aca:4b14:: with SMTP id y20mr5817926oia.160.1578337186997; Mon, 06 Jan 2020 10:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578337186; cv=none; d=google.com; s=arc-20160816; b=fCJNK1BxfakDgI7GwzFWlqB8OTpq07lvhIFH5MyT6ELIoCpR4B44vIhUbdBSxoG/Rc 2PumAG1xP0qsAxHA5ySKdQqs2QyFxUfpmUPKFJHmFohDIKIVUs00Cbbvj89iBGjegP6B Co8+LZF4v/VrPen3o4gOuHAqC7moTvOSZz+ogkokw8Mvf1aD0zkpLFJKr6BR9QoMgTF2 ldiiCSI/lJNA7NzQOI/Ued5EfnbrNp/CqLq6yItmDevDBCUSsDecUP2a4rdTU25awr1n dfop/0r3YwDyGBaqdLmYf77FTxnvDRVVKbRKPNkenIWEHj++a/7vNw0mq/CrOPHd+RcJ bs0A== 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:date:subject:cc:to:from; bh=LGnZKdBBZBEBliR/WeYoazvbanNJLsBGTDKgtgAv2VE=; b=ilhqpM/aQ4OR3aMSwWzU0tFeQtq443RFKzl2eIjflxUh6lnjIDt+FLECCYZV8E37KF 3g1yxxNFZ52LLzADPpGfPn7AaZAgP1vaqgeSnU4lUy/714TsawbsLwQ6FOqKeY0q9YRI II5rq1DlMU1l3mHXHPGjW2zhNr7vIBDW0scvzDGlXhh7VUq23AaGMqOVDTPDwXTN/wkn lhRXaswcPJ0FMJPA96OXEoFqi34bgutvAxMlu7f8HYnEeeP0KipKx3YRE6eg9jB6H6s2 1KDb/TcKwx6lrsn4DWdtXU/utCYzstvTyEWYDl19ySa3evjWGGmwemHbnoWD+p9GIxXt qAbQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q124si30853191oig.228.2020.01.06.10.59.35; Mon, 06 Jan 2020 10:59:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbgAFS6g (ORCPT + 99 others); Mon, 6 Jan 2020 13:58:36 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:35924 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFS6e (ORCPT ); Mon, 6 Jan 2020 13:58:34 -0500 Received: from localhost (unknown [IPv6:2610:98:8005::147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 6AD4429166F; Mon, 6 Jan 2020 18:58:32 +0000 (GMT) From: Gabriel Krisman Bertazi To: gregkh@linuxfoundation.org Cc: rafael@kernel.org, lduncan@suse.com, cleech@redhat.com, jejb@linux.ibm.com, martin.petersen@oracle.com, open-iscsi@googlegroups.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH 2/3] drivers: base: Propagate errors through the transport component Date: Mon, 6 Jan 2020 13:58:16 -0500 Message-Id: <20200106185817.640331-3-krisman@collabora.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106185817.640331-1-krisman@collabora.com> References: <20200106185817.640331-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The transport registration may fail. Make sure the errors are propagated to the callers. Signed-off-by: Gabriel Krisman Bertazi --- drivers/base/transport_class.c | 11 ++++++++--- include/linux/transport_class.h | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c index 5ed86ded6e6b..ccc86206e508 100644 --- a/drivers/base/transport_class.c +++ b/drivers/base/transport_class.c @@ -30,6 +30,10 @@ #include #include +static int transport_remove_classdev(struct attribute_container *cont, + struct device *dev, + struct device *classdev); + /** * transport_class_register - register an initial transport class * @@ -172,10 +176,11 @@ static int transport_add_class_device(struct attribute_container *cont, * routine is simply a trigger point used to add the device to the * system and register attributes for it. */ - -void transport_add_device(struct device *dev) +int transport_add_device(struct device *dev) { - attribute_container_device_trigger(dev, transport_add_class_device); + return attribute_container_device_trigger_safe(dev, + transport_add_class_device, + transport_remove_classdev); } EXPORT_SYMBOL_GPL(transport_add_device); diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index a9c59761927b..63076fb835e3 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h @@ -62,16 +62,16 @@ struct transport_container { container_of(x, struct transport_container, ac) void transport_remove_device(struct device *); -void transport_add_device(struct device *); +int transport_add_device(struct device *); void transport_setup_device(struct device *); void transport_configure_device(struct device *); void transport_destroy_device(struct device *); -static inline void +static inline int transport_register_device(struct device *dev) { transport_setup_device(dev); - transport_add_device(dev); + return transport_add_device(dev); } static inline void -- 2.24.1