Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1838737pxb; Mon, 13 Sep 2021 06:40:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN9cuQpCntMNrM0AHMtOuYbi4W2L7NmaMXe2wPeGI0NbJKq4BS6s6+OMABYaD0flApJQBd X-Received: by 2002:a5e:c903:: with SMTP id z3mr9124664iol.61.1631540428852; Mon, 13 Sep 2021 06:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540428; cv=none; d=google.com; s=arc-20160816; b=et2gkCs4B7+EdRWJLMIyrwVuLffnutd3ijC3D47swUmi4OXWjx+ohc1CZh5WjLnpqM 1l19ZCAiOeCL5w6H4CrrwiRb61NvzW2SERstwMHeTjfkdJtz+y1nl3w43eGznKrFkRUj NUoUn2KMu25WwiI6NZwaf+CkMdRQbOLV+sYaOAHa5SZXjDdhihp0dcMKFdNoFt1sw/aS Kt1qKtHpygjLEtNK6Y2Cbp9itYluFZJW4feEfX+aOSDHZp8t8EUSDCtcCSQoS2hJPZg3 mdWr68EYzkUFNM84+gVadopDXFec86UmhP+eJx05WTqxtJKFjYA+OJLIm598ZDsRh1wB PA+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L8nxoqzLt6spjh/2OvEJp+hB08nJFhAtPe2ixorjyIM=; b=09YmqZO/iPfn94pHrgLuDGYuOCr8aoxg+P4u2h3UBq34LLHgFpzgnxLVRYJDfKyGPx iPRJevIxYIdiCEuRJ+/iBxwTA7pybzp6VQchyhI7h0Zwr8CtFtKQO35MPiImG8IpoCYr lYvxREiFwn5yzqT+tBw4Xfr5oy0q3sPZFginJdFYJTT7yRrUTojQt1yWG1UmidRuttZ7 G4aBrGYj7b5gsnb+M5dahVRqUTA9LiFPhdIjXL/ykjFAXOtRwiiUsL0qwcnLhwVrvsSO 8xmuYh/qAPpxAI9+/DaL0IoHZT6LdLglLgT9/7moPZON177SceBcXs0OSiClGyJrGoze OqCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/Lea1nE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si7847419jaj.63.2021.09.13.06.40.16; Mon, 13 Sep 2021 06:40:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/Lea1nE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243851AbhIMNkH (ORCPT + 99 others); Mon, 13 Sep 2021 09:40:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242965AbhIMNeg (ORCPT ); Mon, 13 Sep 2021 09:34:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9A166124E; Mon, 13 Sep 2021 13:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539607; bh=UWLst1ZD29Mx8vPX0iFVK4aWJ6bg+0Pylzekdndx0jQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/Lea1nEEp/KN/OB//J2oejKsk8J+vtFWQIPjPi06QRyKZcqMVJ/aPIOwSahla3mq 1pz01HAzvzTFPdHFRQb31wNDXZJW96R+Zg1UCXNfXzenHNxzKc5HjVZsa50yqYoSdg vrzxxBh9TtYy//28Qq96pg5y1tlM3+5XAdRRXslU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Zhen Lei , Sasha Levin Subject: [PATCH 5.10 089/236] driver core: Fix error return code in really_probe() Date: Mon, 13 Sep 2021 15:13:14 +0200 Message-Id: <20210913131103.380126270@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhen Lei [ Upstream commit f04948dea236b000da09c466a7ec931ecd8d7867 ] In the case of error handling, the error code returned by the subfunction should be propagated instead of 0. Fixes: 1901fb2604fb ("Driver core: fix "driver" symlink timing") Fixes: 23b6904442d0 ("driver core: add dev_groups to all drivers") Fixes: 8fd456ec0cf0 ("driver core: Add state_synced sysfs file for devices that support it") Reported-by: Hulk Robot Signed-off-by: Zhen Lei Link: https://lore.kernel.org/r/20210707074301.2722-1-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/dd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 85bb8742f090..81ad4f867f02 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -543,7 +543,8 @@ re_probe: goto probe_failed; } - if (driver_sysfs_add(dev)) { + ret = driver_sysfs_add(dev); + if (ret) { pr_err("%s: driver_sysfs_add(%s) failed\n", __func__, dev_name(dev)); goto probe_failed; @@ -565,15 +566,18 @@ re_probe: goto probe_failed; } - if (device_add_groups(dev, drv->dev_groups)) { + ret = device_add_groups(dev, drv->dev_groups); + if (ret) { dev_err(dev, "device_add_groups() failed\n"); goto dev_groups_failed; } - if (dev_has_sync_state(dev) && - device_create_file(dev, &dev_attr_state_synced)) { - dev_err(dev, "state_synced sysfs add failed\n"); - goto dev_sysfs_state_synced_failed; + if (dev_has_sync_state(dev)) { + ret = device_create_file(dev, &dev_attr_state_synced); + if (ret) { + dev_err(dev, "state_synced sysfs add failed\n"); + goto dev_sysfs_state_synced_failed; + } } if (test_remove) { -- 2.30.2