Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2105017ybt; Fri, 3 Jul 2020 00:33:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJEpbtRDHuhbXxJeeCHTW6oeb6ClihS3apXBBSIYohX6S1SGEM1imaIH1zB3lhLJG3f91E X-Received: by 2002:a17:906:46d1:: with SMTP id k17mr30577204ejs.446.1593761602866; Fri, 03 Jul 2020 00:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593761602; cv=none; d=google.com; s=arc-20160816; b=StBZNfFkCKSkX9V72T5VGL5a3Ws1qvWHOYFYQ1ZVk1QxFaLcSt9Rizu61e5YLEzOIV zHt77OowoY2zWLO8DiCVdtTRUV5UHi2M4JPgzhQFfQx1/uBQLAnSs21pT3MKifRo1w3a 5M7m7IjWr2qK1wOLjUoYCKNLwZgLxONPIAjgAC2BHVB8p5MwMwSNdNJdXwXaw41fS3IG bg5V37xE0QCsPfCT6BucC5iHdIFyV6vOWlcb5EZIL0Z3eLdAvXAqLKXQ8S+9cqObz127 F5tMU2lVfsou4Hj7BvRt50jILC3WaQUjTkgRuPh8wdOwlpZvtQwaNDUGKc3hhvyRzjy8 9NFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=x+/vW+OeCuUFfmZ33bKp2kdfIMTrI96qZvK5nkkiTS8=; b=h2C14BTjUCNwKq1yziL+cWLn23gQRrd1tQ/ORdjTtKUTZhNK4ubku+pETEgHaOgJ/Y JYCijDE6OywfRE9Rz+qvaXikthgeeML7tYbPrypZLVroUZakXeaHHxis+Yr/d67M5Tk8 tAjHMMhBfKuSjXdKVEpUIL+skI4plw6lJE/5aFQtKB6yZiLNnT+w8YR2hNVbeQ204U6+ 6fsqtjEWOR/AWGC4WRV3uQ7Gd3BB+prPXjjSEvQ4u1WSIzpgKyBjO5zF1cMDXj509PTf oWsAqHL+AJW+v6h/ARQsxRl+jbWTi6I8jwl92lyMh3QJSR3AY1KtLB5uCBFy+nFBLd/8 6vog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vTATOuPQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si7655893edq.546.2020.07.03.00.33.00; Fri, 03 Jul 2020 00:33:22 -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=@google.com header.s=20161025 header.b=vTATOuPQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbgGCHcF (ORCPT + 99 others); Fri, 3 Jul 2020 03:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725648AbgGCHcE (ORCPT ); Fri, 3 Jul 2020 03:32:04 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62259C08C5C1 for ; Fri, 3 Jul 2020 00:32:04 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id s21so11362814ilk.5 for ; Fri, 03 Jul 2020 00:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x+/vW+OeCuUFfmZ33bKp2kdfIMTrI96qZvK5nkkiTS8=; b=vTATOuPQzML5zSoilwoHzw3DAL41OliM6zI+kKVgVVsC0Q2hSUkdoudQe7Zj/AsBBy QIZR6MeIAocScr5kByrRZdLf8L7FzZTjU+0btvYZB+U2e4NI8exHoKYz8wdsx3i683k6 0jdVR4MmHk/GYYB5JTbd/elg1rvm8T/U+/QDu7Hv5Ekj/jYHjLLOZrkV3mkhN2ZzN+Bo qCWbEKd41cX4C0unh44Qvb2A/7l9/+zIRCWB6vqECnFKuNSLzvsBFQruh/BHY25cBH3p WN9nVnin0cV2XgKukA9RuGEQfNzq2dznlPgj9EFbpHzkoU2K5ABbq6+PAahe4ex7GHje 5/4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x+/vW+OeCuUFfmZ33bKp2kdfIMTrI96qZvK5nkkiTS8=; b=HpPXGeNxCvfkkbUBDMjiQxFtpyTAdxseSmNzVnJtkdc+aq9vFJIf1vy9QKgh/fwGEy twAqALxMvQJ/MVa2BaEvFzPHWcnZKYDYBe1aEJKRSGZ5rks565axx2iudHzYOhODXv4X dlAIzhmPnhl4cuNh6o26YYKyGrm/SMMoS8ul00wnvZ4KeAsUmh5iTojYrTLgIhL1GFyo utLAo7FojdJt/zGVhLhMYcBAVUN1/8Q/wSLY/gve7s3LfnphTyOcwDBucfisXWTcIrof ZmG2HIN+0+i1Cia+sJya+iBr/M5gsD6857mTORPweI/CM7sqjaJ8dxGLsUMz8t/nZ9iZ eTdQ== X-Gm-Message-State: AOAM533masnS5EurutM2r9t7LsV4aoj+sUY9mj6ibI6VZf665P45NJT6 O6ZpJdudtymEunZNKtUX91lMV/yulWujmfOBftpLdA== X-Received: by 2002:a92:8947:: with SMTP id n68mr16903165ild.235.1593761523450; Fri, 03 Jul 2020 00:32:03 -0700 (PDT) MIME-Version: 1.0 References: <20200703071913.2358882-1-yuhsuan@chromium.org> In-Reply-To: <20200703071913.2358882-1-yuhsuan@chromium.org> From: Tzung-Bi Shih Date: Fri, 3 Jul 2020 15:31:52 +0800 Message-ID: Subject: Re: [PATCH v2] ASoC: cros_ec_codec: Log results when EC commands fail To: Yu-Hsuan Hsu Cc: Linux Kernel Mailing List , Cheng-Yi Chiang , Enric Balletbo i Serra , Guenter Roeck , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Benson Leung , ALSA development Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 3, 2020 at 3:19 PM Yu-Hsuan Hsu wrote: > Log results of failed EC commands to identify a problem more easily. > > Replace cros_ec_cmd_xfer_status with cros_ec_cmd_xfer because the result > has already been checked in this function. The wrapper is not needed. Alternatively, you can still use cros_ec_cmd_xfer_status( ). I guess it is okay to have 2 logs for an error. > diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c > index 8d45c628e988e..a4ab62f59efa6 100644 > --- a/sound/soc/codecs/cros_ec_codec.c > +++ b/sound/soc/codecs/cros_ec_codec.c > @@ -90,10 +90,17 @@ static int send_ec_host_command(struct cros_ec_device *ec_dev, uint32_t cmd, > if (outsize) > memcpy(msg->data, out, outsize); > > - ret = cros_ec_cmd_xfer_status(ec_dev, msg); > + ret = cros_ec_cmd_xfer(ec_dev, msg); > if (ret < 0) I am thinking of if it is a better solution to print msg->result here. > goto error; > > + if (msg->result != EC_RES_SUCCESS) { > + dev_err(ec_dev->dev, "Command %d failed: %d\n", cmd, > + msg->result); > + ret = -EPROTO; > + goto error; > + } So that you don't need this block.