From patchwork Tue Jan 31 08:24:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 50679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2630380wrn; Tue, 31 Jan 2023 00:33:15 -0800 (PST) X-Google-Smtp-Source: AK7set8LjYBZAyuOmGkEl360VfbcSX3XfQ+UokQJ5n3ysEStaXVEvXyoZLatyjw+NPS2pm8+H4xc X-Received: by 2002:a05:6402:1f05:b0:4a0:af87:b3ab with SMTP id b5-20020a0564021f0500b004a0af87b3abmr23639910edb.36.1675153995233; Tue, 31 Jan 2023 00:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675153995; cv=none; d=google.com; s=arc-20160816; b=Wzhz1727oSTDf3Nv2BjrpbkbGBJm3tKVNuxmRIrc7u5VXW5EFcy9GASa79uQaD5UEw WI+DWMypW+YvfydASvD7w7/EiKG4gPO6tXZ9/fODi7vdY5MsI5R19qsgzUD/lQDI/b3T 1YOV0Bg1v6ZlWo2PJsX6IrYWBF92PwWER7Acm/oW+ty0ixTLrbrzIGUpjP/4UcnO7Kvo UrlcFvHBGz4Cf+BLsppu6mt9A7+iuj5Ml08jLWfPAapEmebLxRC/Sbm3sw214WKB+HuP 9PDnAekWTeTkWBG1x5KrkDN25LgkzD3ECiHv4gTdtvmJT8VD9zx1Hwa9pC2mF4WLmBsQ y5bg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=hijcx4vDI4rtze5rlMJYYL3kNcnVJsLUW7bJbmH1z0s=; b=M7mrcYIWTCsVvBkJkIK9jcoQ9kFL12AEDnbAnHXgfhcJHJnBc1nJoIVWbVLpzHBXwq oA9gK9tpwRzEeJ1hVIU/0saET7pLgpOfXNRd2kn6ElcVYasb9+tnuJ+CEPuGHRTnAXvT MvhWERQeMkV1S/O0Dc0vwMr678dGWWYuPCh2mxHZwB7Ya34vtt9UKvexA93/1E0EEchy dPzI4l7fJQY7dtCsREXBHqR0vralZoD3fVe30oynWQ3WfLhmTXcJ05dVojd/q/BZMLw0 V90iOzsN63B2IGWfl/sX/+UqSCUqD8K3gouZBWK9H63Oi9guvxrk5TMcfDWlFnGBoBW1 dqFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HLYNvKJ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020a05640226c300b004a270926c49si631308edd.269.2023.01.31.00.32.51; Tue, 31 Jan 2023 00:33:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HLYNvKJ2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230444AbjAaIZM (ORCPT + 99 others); Tue, 31 Jan 2023 03:25:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbjAaIZJ (ORCPT ); Tue, 31 Jan 2023 03:25:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D5F3B0D4 for ; Tue, 31 Jan 2023 00:25:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02BFDB81A0A for ; Tue, 31 Jan 2023 08:25:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C0FC433EF; Tue, 31 Jan 2023 08:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675153505; bh=RtmuTq5OHnGLeEYC2dmIQ+MQrc9DTxQd1PUggq7HCe8=; h=From:To:Cc:Subject:Date:From; b=HLYNvKJ2ugjHkQzsTisgHdPxKK8CfPoT0eT3JEMEru9BpZ9iqa0PU3BcNMVs6MMEk GKpYSpCxGP6ACscVcjmUdO+5iQU1U8xQwkq+WhzZ5pxFszRvNXXlnzhF+P4yJixLEO vutlfMNlhvjqXOGO+bJke9RqHrqiKWJyfiksQu+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH 1/2] driver core: platform: removed unneeded variable from __platform_driver_probe() Date: Tue, 31 Jan 2023 09:24:58 +0100 Message-Id: <20230131082459.301603-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1913; i=gregkh@linuxfoundation.org; h=from:subject; bh=RtmuTq5OHnGLeEYC2dmIQ+MQrc9DTxQd1PUggq7HCe8=; b=owGbwMvMwCRo6H6F97bub03G02pJDMk3LkSu2xYfOVGkUmGz6AxPvn83+PlLPKU/TZ345F1TX/P3 VTvXdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBETl9kmCvwUfbi6/eFt5ZxHtxd9q uvyDi77jLDgrYc3i3aNkIGc6d86qqVdrbgc3nBDQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756526275454193356?= X-GMAIL-MSGID: =?utf-8?q?1756526275454193356?= In the reworking of the function __platform_driver_probe() over the years, it turns out that the variable 'code' does not actually do anything or mean anything anymore and can be removed to simplify the logic when trying to read and understand what this function is actually doing. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman --- drivers/base/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 262555b83bed..423874269f9d 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -906,7 +906,7 @@ static int platform_probe_fail(struct platform_device *pdev) int __init_or_module __platform_driver_probe(struct platform_driver *drv, int (*probe)(struct platform_device *), struct module *module) { - int retval, code; + int retval; if (drv->driver.probe_type == PROBE_PREFER_ASYNCHRONOUS) { pr_err("%s: drivers registered with %s can not be probed asynchronously\n", @@ -932,7 +932,7 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, /* temporary section violation during probe() */ drv->probe = probe; - retval = code = __platform_driver_register(drv, module); + retval = __platform_driver_register(drv, module); if (retval) return retval; @@ -944,11 +944,11 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv, */ spin_lock(&drv->driver.bus->p->klist_drivers.k_lock); drv->probe = platform_probe_fail; - if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list)) + if (list_empty(&drv->driver.p->klist_devices.k_list)) retval = -ENODEV; spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock); - if (code != retval) + if (retval) platform_driver_unregister(drv); return retval; }