From patchwork Tue Feb 27 14:09:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 10245471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C197C60362 for ; Tue, 27 Feb 2018 14:18:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B124E288D8 for ; Tue, 27 Feb 2018 14:18:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5FEA28916; Tue, 27 Feb 2018 14:18:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFD46288D8 for ; Tue, 27 Feb 2018 14:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jdAgbjXBPfNrtGD3GWGCpJmA/ylpoFYq0LGBIzjgluU=; b=S+yuPYAFFrpvuuwOof1Tr6w9QH jUctSMWaCB01Xlf5rvR3jUKPRSCRlS4z5jgoVErEjYnWw7sDGIJGAt8uy6DvpeKlMERgK6oxf5UCx pomR8wu3a4YdVfyFOi6FnCzH8iXoHL8Apu9Seo6sKXV+e+h1R7OwfvivtwFH9Z+D+8jOkPL60fWW/ 3+RR/MM5CAqm0VO19BnRGWQEaTAmQ6jycyryEDz+gBifvvC1aCjbgs4raFVKs6GQCf2SpG0mRs/Ch hwu9Lie0mhuvOYWOLQI5bxunFIZQdyCMxkQrGCAP7mseKKUmhdxZmG8JvGgwI+G24uMMwZpKBEFQF iFNS1vqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqg53-0003G9-Gc; Tue, 27 Feb 2018 14:18:09 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqfxC-0004Sd-AT for linux-arm-kernel@bombadil.infradead.org; Tue, 27 Feb 2018 14:10:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=P2s3ioqe442gj2dQTVDSU6ION pLTAsRfpfrwgEUeg/k0xWmpS3Aq/tLBpUI9HFMqFMB0r+PP1GNdfFpAofY7KzhiKzaqpqX0JSMPiB 5ZhqWODjWxui3AmtuqY0/rI4tcFU+ZwqW18RGTUcuxE4Hr9hoRl4SFdzi1ce7MEb0//VfcYM+vbOq jAEveDjOkiOW6RK1d5AY02FMCM4yzCJY7OGWUjPwQ4m11oPEx279MdUp++k0aqMYs3EZz9X4p0OrP o8vRTJixQVwr2lo0OtnXSIpgGr7m6qOQdKEOqq0QqTMkU/6jRWUGSCgcJNlLfsNqVaIcQNyg/FvZ0 qvKKWruZg==; Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqfx7-0007Lj-K5 for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 14:10:00 +0000 Received: by mail-wm0-x242.google.com with SMTP id t3so24323198wmc.2 for ; Tue, 27 Feb 2018 06:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=Ods7cilqPhNaxE4tyik8AZ2peEbqRCRPiDxn02WsvA6n/BzqNmgn0yMa4Po9AmKyGM AENOAD5zTAdjaPd0V5a/SNfLLlBz4VVULmqgDSjIlht4azLEloA/uQ5QLscZOFOvHkOd dnZMZnVqNf3O3V8jAl2/orYWKbtLyuCfvA0Rg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=qXiq/7jKby6JOv2BfUQwJKkfuhJ/1fpOj6e2kQjy5NvXU2C9XE+IEWzqij9JpzVR/+ ALpSmKIKqEQfiu4IfhCGGBg74ttJ8iBVCpM/Hf2urXskOKVv66kWOV1zDWiJVbcLmKdq vt+hErx3P7rJu4GJ53dsvILZOYG1eoJkuuaPPavkPh7Om8ldh8G4RP6dbthcyIbXKOu3 MmW5jyGf8BT57/MxoaZR2sP2IW9i7+0tWdfvvUS0XQPTAiG7CPdq6NWrp7EHS2nQ+Qqa hJo2VaurW3NxIwmXunVth55kyuenE/g2jVogfL9zl/W9gt3ZePimwkXZFA5UZgyN1jCU wuGA== X-Gm-Message-State: APf1xPCBVnk9ZwRSA5VMGP/u3BmNtRE8tD5Tb//gX9SN6Bm/a7q1qfnG EcC3FsvydhzS1FnrOV76U5H5zw== X-Google-Smtp-Source: AG47ELvn5PUSlAl3q1WfwH5Rzx/P9opWmWNd9L8+Xv9RLpH2YIhVTd586RsbyEbMGWofDVW/Kn8lQA== X-Received: by 10.28.245.3 with SMTP id t3mr10887727wmh.134.1519740582312; Tue, 27 Feb 2018 06:09:42 -0800 (PST) Received: from lmecxl0911.lme.st.com ([80.214.71.157]) by smtp.gmail.com with ESMTPSA id 59sm6514496wro.57.2018.02.27.06.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:09:41 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Subject: [PATCH 1/3] driver core: check notifier_call_chain return value Date: Tue, 27 Feb 2018 15:09:24 +0100 Message-Id: <20180227140926.22996-2-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180227140926.22996-1-benjamin.gaignard@st.com> References: <20180227140926.22996-1-benjamin.gaignard@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_090957_672362_DC5D4E7A X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Benjamin Gaignard MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When being notified that a driver is about to be bind a listener could return NOTIFY_BAD. Check the return to be sure that the driver could be bind. Signed-off-by: Benjamin Gaignard --- drivers/base/dd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index de6fd092bf2f..9275f2c0fed2 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -304,9 +304,12 @@ static int driver_sysfs_add(struct device *dev) { int ret; - if (dev->bus) - blocking_notifier_call_chain(&dev->bus->p->bus_notifier, - BUS_NOTIFY_BIND_DRIVER, dev); + if (dev->bus) { + if (blocking_notifier_call_chain(&dev->bus->p->bus_notifier, + BUS_NOTIFY_BIND_DRIVER, dev) == + NOTIFY_BAD) + return -EINVAL; + } ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj, kobject_name(&dev->kobj));