From patchwork Mon Sep 13 13:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 509762 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp611265jao; Mon, 13 Sep 2021 07:27:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEYwMJ6xxfm1xaCrpUUKcQ6j91vIdbdQk9x44QMDmT+dKeQM1En7M8JAnHOpyGXXqyFrIx X-Received: by 2002:a17:906:3012:: with SMTP id 18mr13480281ejz.136.1631543264730; Mon, 13 Sep 2021 07:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631543264; cv=none; d=google.com; s=arc-20160816; b=cqpHhM4Ogr8ldwGpkcvDUwZ9MSu++VGVhmdNGf3YmlN9fGRCgvMHjm6oBYlovMLx4y yl8JRZFHZ+T/3MIR45UxQAnOw4VXwDJUJTh0PkkOk30C/kKjIoJSqnEqopcbDbwC4q+i iA2GsPwdzHena6Z/QN6iQEwEQRM3XdEzSdY5yvitcmUS6Ho7SAYe4R1zCXagqdeCRSk7 yZ2wipH1NIm4AoFhuzGbyTY0GttOrU6NriHpp3vdeqlZoML4P5feGUolVxUNTVDaet9h 70QNr3C5kxZ16tE4xS6KHQQMc9hdBYNRLxmnK10ON6RwaoTrJLZeXFxVJDBFRYoPV7X+ CduA== 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=RwQ6ScgmgYTgoekibn80nYNvUvZ8YXE0rLlkZ8ofT3c=; b=P9A4Q+YVKDKl0+RUyPj+OoNbaU+WlgiIUwn9k3s+S9jV37k02id/W+ufz2MKemA0Bs 5ChiPcg73RCjZZVc1jOx0onhGmfJNMHX+y+jFXQ0W5DDYmfj1BO/nLqNLWB8BnB10H1e zwvJbPfBmfZlAiRMdnG9iX5NrnRDEYPjanDnjLpQErZXjRZRD5ufTpBzQ8nmZm5xOc3t fyL5icUG1dt3Y2JjUdYxXy1M8aL53EKcYD1NN6Q9mfsNgUA/hqJgS+2XCdWR6DyHPIr9 5gYcEhmYw3CnwhuhhW+EmOiFYjfDy8mzPzwIUQAnIBL9dc86eWUt6t80k6/pV4IF7Ndf Ot9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WLPF3KzB; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 b17si935604ejl.601.2021.09.13.07.27.44; Mon, 13 Sep 2021 07:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=WLPF3KzB; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1345009AbhIMO2x (ORCPT + 11 others); Mon, 13 Sep 2021 10:28:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:45636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345785AbhIMO04 (ORCPT ); Mon, 13 Sep 2021 10:26:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B531F6136A; Mon, 13 Sep 2021 13:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540968; bh=rKTS/nWBZfsxfFC4uj6EZpuILt3KjEXzscEaEa/h3dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLPF3KzB4u+jCl6xvGiuSc2gRsA3lD6jncRvLGjCbxwAu+FstfG5aDHTohOEnrWjz n//fYNcHyqrV0qBzxQBQaJk3rpUxwOHSEKilvSHpNVDf+BDGaq18iKl4NolEqqNu1M B3Hv0y1c0oeUoJr0DumU3KWFFyX4Z2aKDRAIz8ec= 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.14 109/334] driver core: Fix error return code in really_probe() Date: Mon, 13 Sep 2021 15:12:43 +0200 Message-Id: <20210913131117.060419491@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.30.2 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 437cd61343b2..68ea1f949daa 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -580,7 +580,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; @@ -602,15 +603,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) {