Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2940641rwd; Fri, 16 Jun 2023 10:04:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pAZ0lcOJ7fjfvNhQRWayWytKxhgU1+Ly9GcZ1kjWjnRzuCrB5YcCmDQ9zDIem4QCPzO/v X-Received: by 2002:a05:6a20:959a:b0:11d:bc14:85a9 with SMTP id iu26-20020a056a20959a00b0011dbc1485a9mr2578238pzb.37.1686935065408; Fri, 16 Jun 2023 10:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686935065; cv=none; d=google.com; s=arc-20160816; b=xsQdnp2q4q92aSwh2oQl4A2jAUHUpq3JLk9UlZwo5xFEq6j2uUFu+kXWFZqI1wK40a ApkZqlh9feszugaQf7IV/BhOcV1RIojSW711FB2zhyrPNyfRDysrdvyxWLAaW2keLNCn Yv2AOSci95nsL7JF3US0g+Muiw5qD/CCOtUoftWc+QeBOXpRaLPmRwS8OL9HllU3iMhA 2/xmMjBX3BR5PmzuyAHU41ul4AS72YZ+mi8dkjEpSznnFwv3+jbUDgy+NOIicixzHBpk 4yPdHPAvv2XDQVJF6Afgd3c1RG3qnlsVXVoNukl7co0++w6f+IkedqrLtakSTVwZeJq4 MRIw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xnshg5znPQ0V+2Zp8NYKfqNrD2Zil6eOSYsSinzrRis=; b=h85EDBCmup6bQA+sJFD8BXliVW7jyeszdCrZG7Lj+GGYDL+aa3bn2ThFfBnEk/jhUO ezUnaYgyVCrtRc4tN9fT2Mk2et6N0+DnKLyzZddK+NB/9MEc+hi8UQhuWu+KqTYgjN5E 2+b4tXe0sktB+SLPc99s/2q/sGPC3ElgGtJNb+GK409/kRNP58t692RVwUGl1q3AdZ7h zts9sI8H7sEZ+d+0YdUwOc1Ft812lxqDMURBXnlb/Jf90nAtuWGTaTyYtz9n8ugc/Nvj EYB9SPJOkdYKDaWfaFjkODGCpaifGfWN/SZqOu8cs/NnL7u4KK9TIy7Ri724TIijTSeT v6qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VXEPalEL; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j187-20020a638bc4000000b0054ff0e193e1si4010241pge.772.2023.06.16.10.04.12; Fri, 16 Jun 2023 10:04:25 -0700 (PDT) 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=@intel.com header.s=Intel header.b=VXEPalEL; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345689AbjFPQvG (ORCPT + 99 others); Fri, 16 Jun 2023 12:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240942AbjFPQvB (ORCPT ); Fri, 16 Jun 2023 12:51:01 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1488630F1; Fri, 16 Jun 2023 09:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686934261; x=1718470261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LJTbIfA0UENMk0xVXSZGWf0/1PqMliH9RFpRpZHd0Iw=; b=VXEPalELyco0bfzCN6f0LELcsocPbaYocLRzwUK//TsgNEZ2lB0rlaNa +d5U+jYsRUc3m+gf5HNJvlvRfvNrEn+SuexjrohHAs+OsJahEydO2/37I 7onuIl4K9ppDSeP7WZlvY6h4sVQAwKjQ5RsOnv3dGRTJVkjdCtD23xjh7 gIoPLrOK/rSapS6O6hy22I3RHg3GwUyGXUF8qgtKIB+USqDRWVklu6rQ+ Zd4KRygY99KDUDjHAJKqitXnKe3p6NsbJzqk3EfvYznuluwXo1+GpZeIE I3xNyiIbY0YVQNifgzP+8EYOcj+9mrsZ6on6khSjq3uhq9CussNaYngC8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="422912971" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="422912971" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 09:51:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="707154105" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="707154105" Received: from powerlab.fi.intel.com ([10.237.71.25]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 09:50:57 -0700 From: Michal Wilczynski To: linux-acpi@vger.kernel.org Cc: rafael@kernel.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, lenb@kernel.org, dave.jiang@intel.com, ira.weiny@intel.com, rui.zhang@intel.com, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, Michal Wilczynski Subject: [PATCH v5 02/10] acpi/bus: Set driver_data to NULL every time .add() fails Date: Fri, 16 Jun 2023 19:50:26 +0300 Message-ID: <20230616165034.3630141-3-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230616165034.3630141-1-michal.wilczynski@intel.com> References: <20230616165034.3630141-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Most drivers set driver_data during .add() callback, but usually they don't set it back to NULL in case of a failure. Set driver_data to NULL in acpi_device_probe() to avoid code duplication. Signed-off-by: Michal Wilczynski --- drivers/acpi/bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 22468589c551..c1cb570c8d8c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1017,8 +1017,10 @@ static int acpi_device_probe(struct device *dev) return -ENOSYS; ret = acpi_drv->ops.add(acpi_dev); - if (ret) + if (ret) { + acpi_dev->driver_data = NULL; return ret; + } pr_debug("Driver [%s] successfully bound to device [%s]\n", acpi_drv->name, acpi_dev->pnp.bus_id); -- 2.41.0