From patchwork Sat Feb 10 07:09:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13552187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C22FC4829A for ; Sat, 10 Feb 2024 07:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CGhPEKx+swY5HfSmblhNMH+422EfP3gZYlBXG/r3p10=; b=cJfiRDaWj0VYYZ 6wZl/cwnBDSj8j420lwIuIkYxo3q5idR1B43rbORzNBEjAtDwNA+8OmCt12ytjk1QfgP0+rAtlz8Z pjLQdABarlrDNv6sy05TSA1uxjh3+WanWrzbXT974D/YZ1ViOTGAKBFkUWcJd4+1lq+51hayznmEP /bZlgTAcp1Fmip2RlVslitBf4SAnQ+jYhpze+AdQkKEfHCQ5CDSSQ0aL0L0xMmP779+dq2I/ZNZMC 8NBuxUtas6Tkpkbw72kDjTjv0wFoDihYT7cjoWHG4GQUwUcLwtXUKST8KaYKBegABtQruO+C7oJVV SuzwxquywQ8S4CTBAn4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYhVT-00000001KFC-2DWb; Sat, 10 Feb 2024 07:10:35 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYhUv-00000001JoW-15jG for linux-arm-kernel@lists.infradead.org; Sat, 10 Feb 2024 07:10:03 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d94b222a3aso14517305ad.2 for ; Fri, 09 Feb 2024 23:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549000; x=1708153800; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7RRDNZyVj04t5JHoAjAOJhQ0Jr4YTOazbyEccudCdmM=; b=JjN7s+swTxux8IwUqK4itOVIhP368N6IzXUoWEzCWs9C8zBADWi2URzy2rKP/rTrn8 A0hXsdeIQT1bnkjviOVJmrYEaOQrZUWExFIUCAiiDrKXp/CVYS6u3Ybu3qz9U35AI2N+ b2YdfXq+5yJKdD3GpuvptJGiyIkeT5lJh+3+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549000; x=1708153800; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7RRDNZyVj04t5JHoAjAOJhQ0Jr4YTOazbyEccudCdmM=; b=TK251tjnW2o6mgQA9FWf3hP+NfAK2lQYg3ji1mA2axm0wE2lCm2JUvB11m8GWSnNs7 aMftM7dXgbHcqDN13TfA6e/6DSWvCDmGk9y4DuHNnM37NJvRYVh/PQy9n1iX00rs30cQ GWaBas7dCKIw2XBWAXWzkaWsYTY9vbXBOw4tatViv/eyFnhlCjamPx88+zqxQ4qXOrp+ xa2/510zYqiD54x1BOmWlh2OLIvY9HC9nUuKYIlZejpO83bMUzUeEm46Yw4xSsPFy6wh 0tJQdCmlX7JokvXFQ9z/QUZTTM9jzgQDGnkgGufWARBCyiZ1uy6MPVpmpmVtlW2kK7mM 1LEw== X-Forwarded-Encrypted: i=1; AJvYcCX1PJgIBlz2iZ2Swb4TXz+f/6Y5G9Bqb4e8txgF1PZbRjOG38e3L2u20TQ8RFgWRajZ0psN9g9uu/hgKRHAnBn2+2JEMx2Qk8plZRg6dn98OziDkMw= X-Gm-Message-State: AOJu0YxSfDFlODrIIwHoIRBfAFXw2LH38qq7DXump7OqlDbJHas1k7Jc nLDo2glZvMjHYmYDTLBpibrbWm8eU92nu5UdG5cA9X8cNH5WqGhOsaEvz6uvIg== X-Google-Smtp-Source: AGHT+IH18BL+v1/eWB00jAhbCH1MDFkNv9w/KlvOVehkJbrbvpOewOqpcto8HNZ+VsYssctW+PUIzg== X-Received: by 2002:a17:902:ed0d:b0:1d8:f106:cb92 with SMTP id b13-20020a170902ed0d00b001d8f106cb92mr1839715pld.10.1707549000129; Fri, 09 Feb 2024 23:10:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU0h1bRFaEg+rFVuvzPvT72dcm+HAwsdsZCtHAhkEgEg7ayFRJauNl11VSY6YyDygPUNI2UG6VppFLvyEcP1cUA7q4TWT/wBEpaKTuLlo1sFWBgnfseptqeqG6Hg1IkRQ9dNwDd4lqNtxcY52R6emzrYCP7HCrScCjDEWljoS6c7AOh87gnSGt5+hp5SlsPjSsnpQtKieFzEbu0EOef+qB5OGN6nxsB9GMlCKqB/j68OVjeK744K3lk0ESlRGxMYhNXMCSKFgk8Elqiyq2vZevQj+KQpmzXdYRkOfd+wDBcyqvMIwCuM9ETiJeHyCkeUomMvvZov9KbLZH8a3E6K5cRdwkpph2vzwvMDbKrzGVewJpz8y0J7g== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id kw3-20020a170902f90300b001d9fc6cbc51sm2487629plb.244.2024.02.09.23.09.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:59 -0800 (PST) From: Stephen Boyd To: chrome-platform@lists.linux.dev Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 12/22] platform/chrome: cros_typec_switch: Use dev_err_probe() Date: Fri, 9 Feb 2024 23:09:23 -0800 Message-ID: <20240210070934.2549994-13-swboyd@chromium.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240210070934.2549994-1-swboyd@chromium.org> References: <20240210070934.2549994-1-swboyd@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240209_231001_379445_2B20F5B8 X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use dev_err_probe() helper so we can get better diagnostics when driver probes fails for any reason. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 36 +++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 373e0e86ebfc..769de2889f2f 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -219,31 +219,23 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, if (adev) prop_name = "_ADR"; - if (!adev) { - dev_err(fwnode->dev, "Couldn't get ACPI handle\n"); - return -ENODEV; - } + if (!adev) + return dev_err_probe(fwnode->dev, -ENODEV, "Couldn't get ACPI handle\n"); ret = fwnode_property_read_u32(fwnode, prop_name, &index); - if (ret) { - dev_err(fwnode->dev, "%s property wasn't found\n", prop_name); - return ret; - } + if (ret) + return dev_err_probe(fwnode->dev, ret, "%s property wasn't found\n", prop_name); - if (index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %u\n", index); - return -EINVAL; - } + if (index >= EC_USB_PD_MAX_PORTS) + return dev_err_probe(fwnode->dev, -EINVAL, "Invalid port index number: %u\n", index); port->sdata = sdata; port->port_num = index; sdata->ports[index] = port; if (fwnode_property_present(fwnode, "retimer-switch")) { ret = cros_typec_register_retimer(port, fwnode); - if (ret) { - dev_err(dev, "Retimer switch register failed\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Retimer switch register failed\n"); dev_dbg(dev, "Retimer switch registered for index %u\n", index); } @@ -252,10 +244,8 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, return 0; ret = cros_typec_register_mode_switch(port, fwnode); - if (ret) { - dev_err(dev, "Mode switch register failed\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Mode switch register failed\n"); dev_dbg(dev, "Mode switch registered for index %u\n", index); @@ -269,10 +259,8 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) int nports, ret; nports = device_get_child_node_count(dev); - if (nports == 0) { - dev_err(dev, "No switch devices found.\n"); - return -ENODEV; - } + if (nports == 0) + return dev_err_probe(dev, -ENODEV, "No switch devices found\n"); device_for_each_child_node(dev, fwnode) { ret = cros_typec_register_port(sdata, fwnode);