Message ID | 20240219033835.11369-3-raag.jadav@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1124112dyc; Sun, 18 Feb 2024 23:15:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBwhKtD6ZMe4NNLT76bizQNUoxvjRt7kxmu5lJV/x9iH9eAgHY3KK9LTQocXeHjTTEsDyY+SGKJ9FETWhdl5ayL0Fz8A== X-Google-Smtp-Source: AGHT+IHD82eplPf64McC3Qy0VtUrT42psd/AfG8X21r64su9IGxWyXr4k8MwavtJ2crwsUteMd+r X-Received: by 2002:a05:6902:250a:b0:dcd:3d6:68ad with SMTP id dt10-20020a056902250a00b00dcd03d668admr13581178ybb.0.1708326921023; Sun, 18 Feb 2024 23:15:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708326921; cv=pass; d=google.com; s=arc-20160816; b=pzMDrnddA7c0VQsuEVdNlf2isGhNvXufUbxukTDShHviVmpyILaC1+lQInWCxnLxzq L1N5Vc6xXr7YtA6pZDgDqMmOQiMTnASRfqOakyIZbl6lDqPGsOQHm03BuXkfc4sx+RAn 5SlAIKt/eeKuIJrUyUJwzw3GKE5joPmMp/tlmHYHJjqlos5v48ARErsN9EVdD1prjYc1 HHgAD7FwHZaJNEGmyTORUJ7fjm8dpxIGi3FEQqTfSLQOn2vf63n+WjK3C1b21w/0hoKo jQujBf7BS0SYParaWZBZB9lM0uyDSQgTzFFThEknLeYuSf5I+MX1jWvWnn/CpAnLuqZj zN1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=shXdF11uoxnCzXdxka0Uvc/20AM6LbeqGXjRLg7rsZw=; fh=y/RjPbXBoPouJTPaYxwEImQW6x8GRiLpamQFwed/jf0=; b=DMF9GB830TUeKc0lZnrGoOsRaGvxpnD72wG1q8LlbmXQcbolb0yL7CaBNAmUopuM0t uMA+6WtKfpttWm/U1SO5ajMq9Sp+ptod73zfMI8jYEjCDDFopYIbKv1WnRQSIxIU18dt xECnGumFxTpc/WLxdgoEao+Y3UIgrLwHHz95lQG2B1oJwtAaaI68GxBj/+x1KX0ofyQy YnEtpNQ08OX6bF7Dp4EDLW5LafX/+7bAzJwi1RXrv3/enGRkV1mclj8UsmKLgyDXV0LE +CLf5BukqumQzsxIpjt4r4IaNqukfJNDfQy0Th5kUhWKG1lr0YsQdi2EIWvp4UF3XWko 8uZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKzljqlJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m17-20020a05620a215100b007876e8bc91dsi467137qkm.674.2024.02.18.23.15.20 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:15:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKzljqlJ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70675-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 143411C21479 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 03:39:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AB9F79E5; Mon, 19 Feb 2024 03:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aKzljqlJ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E0D84C75; Mon, 19 Feb 2024 03:38:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313936; cv=none; b=Hz1rC99ZdrVvZmyyP/aNQF74erhbiHF08+CHJWHkbzVQZx99rSy8XLlo3c/E3sk60qHBg8QFGLSV/2pkMRBHg1zjiAItwKWzOFSYvHoJlR+gAHcVuI3rJQSLGlURBuN9a0kpY0Ec3iRnM/Hyffgdo5/Y4S5R8Se/dA1i1jQPD3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708313936; c=relaxed/simple; bh=RIlqr5IIc2NcV+R4QbrZ4SeTtXAfOYhjo+jbzFUSD3o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Et7QhdS9ubzWRqfEwynEeTRtQJFmRhc60h+RsJB7i8rD+In9YuAtPz9pTac2xxR2PzqwCJSWAsfOu/M8G8KzKFirRJC4/vm34LM0dNKM2+IQ8sVNEjL2S9ktl1VpGF+xsuvmDZo5fFJOJqMhT1om1pfD/HQq+W6jhLLkz9xpmb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aKzljqlJ; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708313935; x=1739849935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RIlqr5IIc2NcV+R4QbrZ4SeTtXAfOYhjo+jbzFUSD3o=; b=aKzljqlJeRDBAEmSHE/MnO6HUXmaKvMbpuC128fAQhQaRYP8iEC5iAGv xFSDZ8z9b8eUPthtuvqst7kBtFN5TfnOS8KJEMRHrOWM+27DFlUhQWzVm xhwzLrRO3VvkTkz4t760RAX79lDd+VKehDUVLM+yFjRlT8igSYikjVCrA 0dM7ffQP0+vG+m90gmpGQDASKhVzcFC/NqeSKYB8GpaBMpK6IVCfSpIox AhJ6wB2mrmT3fI9KTZfP/AM6bKfNWrh6oFBlXPSM2yMGbGvGxiQ0rG80w SoSmzTgwjo29rSoXKO3CSXwVifC1lpkwnfOoqJLLj61JmgvhbhlrlEr9p Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="24838171" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="24838171" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2024 19:38:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4281846" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa007.fm.intel.com with ESMTP; 18 Feb 2024 19:38:47 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id C76AA72ADC; Mon, 19 Feb 2024 09:08:45 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id C30251600102; Mon, 19 Feb 2024 09:08:45 +0530 (IST) From: Raag Jadav <raag.jadav@intel.com> To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Raag Jadav <raag.jadav@intel.com> Subject: [PATCH v4 2/4] pwm: dwc: drop redundant error check Date: Mon, 19 Feb 2024 09:08:33 +0530 Message-Id: <20240219033835.11369-3-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240219033835.11369-1-raag.jadav@intel.com> References: <20240219033835.11369-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791310373024956856 X-GMAIL-MSGID: 1791310609502424382 |
Series |
DesignWare PWM improvements
|
|
Commit Message
Raag Jadav
Feb. 19, 2024, 3:38 a.m. UTC
pcim_iomap_table() fails only if pcim_iomap_regions() fails. No need to check for failure if the latter is already successful. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Raag Jadav <raag.jadav@intel.com> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> --- drivers/pwm/pwm-dwc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Comments
Hello, On Mon, Feb 19, 2024 at 08:11:00AM +0100, Thorsten Scherer wrote: > On Mon, Feb 19, 2024 at 09:08:33AM +0530, Raag Jadav wrote: > > pcim_iomap_table() fails only if pcim_iomap_regions() fails. No need to > > check for failure if the latter is already successful. > > > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > > --- > > drivers/pwm/pwm-dwc.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c > > index c0e586688e57..7dbb72c80ef5 100644 > > --- a/drivers/pwm/pwm-dwc.c > > +++ b/drivers/pwm/pwm-dwc.c > > @@ -51,11 +51,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) > > return ret; > > } > > > > + /* No need to check for failure, pcim_iomap_regions() does it for us. */ > > IMHO this comment could be omitted. I like the comment (and even asked for it). Is it really only me who doesn't know that after pcim_iomap_regions() calling pcim_iomap_table() is unproblematic? Best regards Uwe
Hello, On Mon, Feb 19, 2024 at 08:11:01AM +0100, Thorsten Scherer wrote: > Hello, > > On Mon, Feb 19, 2024 at 09:08:33AM +0530, Raag Jadav wrote: > > pcim_iomap_table() fails only if pcim_iomap_regions() fails. No need to > > check for failure if the latter is already successful. > > > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > > --- > > drivers/pwm/pwm-dwc.c | 5 +---- > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c > > index c0e586688e57..7dbb72c80ef5 100644 > > --- a/drivers/pwm/pwm-dwc.c > > +++ b/drivers/pwm/pwm-dwc.c > > @@ -51,11 +51,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) > > return ret; > > } > > > > + /* No need to check for failure, pcim_iomap_regions() does it for us. */ > > IMHO this comment could be omitted. I somehow overlooked the discussion in the v2. Please ignore my previous mail. > > dwc->base = pcim_iomap_table(pci)[0]; > > - if (!dwc->base) { > > - dev_err(dev, "Base address missing\n"); > > - return -ENOMEM; > > - } > > > > ret = devm_pwmchip_add(dev, chip); > > if (ret) > > -- > > 2.35.3 > > > > > > Best regards > Thorsten Best regards Thorsten
On Mon, Feb 19, 2024 at 08:27:43AM +0100, Uwe Kleine-König wrote: > Hello, > > On Mon, Feb 19, 2024 at 08:11:00AM +0100, Thorsten Scherer wrote: > > On Mon, Feb 19, 2024 at 09:08:33AM +0530, Raag Jadav wrote: > > > pcim_iomap_table() fails only if pcim_iomap_regions() fails. No need to > > > check for failure if the latter is already successful. > > > > > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > > > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > > > --- > > > drivers/pwm/pwm-dwc.c | 5 +---- > > > 1 file changed, 1 insertion(+), 4 deletions(-) > > > > > > diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c > > > index c0e586688e57..7dbb72c80ef5 100644 > > > --- a/drivers/pwm/pwm-dwc.c > > > +++ b/drivers/pwm/pwm-dwc.c > > > @@ -51,11 +51,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) > > > return ret; > > > } > > > > > > + /* No need to check for failure, pcim_iomap_regions() does it for us. */ > > > > IMHO this comment could be omitted. > > I like the comment (and even asked for it). Is it really only me who > doesn't know that after pcim_iomap_regions() calling pcim_iomap_table() > is unproblematic? Neither did I :) (Check the v1 discussion) Raag
diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c index c0e586688e57..7dbb72c80ef5 100644 --- a/drivers/pwm/pwm-dwc.c +++ b/drivers/pwm/pwm-dwc.c @@ -51,11 +51,8 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id) return ret; } + /* No need to check for failure, pcim_iomap_regions() does it for us. */ dwc->base = pcim_iomap_table(pci)[0]; - if (!dwc->base) { - dev_err(dev, "Base address missing\n"); - return -ENOMEM; - } ret = devm_pwmchip_add(dev, chip); if (ret)