Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp870310rdb; Tue, 30 Jan 2024 00:33:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgrwT664urzZYPEvEi2Dmr9RhFsj+iaYTYCZu34+zduPeSIwfCVQ8zTw2M3meKUhk04hQF X-Received: by 2002:a05:6402:1d4c:b0:55e:e6b3:9edd with SMTP id dz12-20020a0564021d4c00b0055ee6b39eddmr5144431edb.23.1706603592034; Tue, 30 Jan 2024 00:33:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706603592; cv=pass; d=google.com; s=arc-20160816; b=TW1Kvbe3vXOlzdhtR6SVxEQpy/C4IK9I5r3WFTJ5oKlcTBrEWVCJCfWYDYdYuPQ0nD nuLR/drpzvPq7GvsYsCW+k9MZR2Yoqx5rw50tKTNseCksyHGbPYvlVQfIogV50Bnz23E 7l0wdFhILvXVYnqbXAHkMzmdgMdA8GDL85+fz/wT+TElWxARv6V/10SbEChQRENXsX6F efrM8V85bpLoRX+yUzFFnX+b9i5+UW5qOUQDPOh0IrGZMcnJVLuBODyZsTnGm1WncAEB qm0Dua0zNnisOdYlouzscHBffm/CIwDQAtlaOXf9B2Iq4AqaDCOyaOrGJ5Y8MQo+sJVk l2qQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=f2LbaYxuXB8kwo9HYFQYx14yMU9l4lQtFEHBqUmYniY=; fh=NR9R1x7D2WBNvFHI/6aOclRJd4GCOaCqnD6dtm7vOvY=; b=sL2qQsQUOT2wYMJw8S3k9D/FZ8Xf1zmT3O+Q4mM3ItVKKoDEJhnOpuIJFPOtIHl2Bk ZM3UBw9zp6A4qtfr/vP7nnlEvnA/LErBlBiLoY0KqKeMjsOzZYs3DVdncef6wC/7Ta2D 03QGziLOwwmB0Pp5zMDDXIyF5JV4KlNcpTYvMb3y41QrFL9H1rhfZ/uYGlkWpcJfNgVn u7lWs3jNNfTXhHPV0XN7hi0gdrKU5jDvp3IoiL8Dm0RNazCwdu42dkWRHTMwCmXJDzQ9 8KOm+4zs9jZ55z8A5L3g2YbBhC8JWEksifruf62Fa133Q7iDR7gT0diJZpTp4XXs33vm YZiQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RirXi2tD; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-44138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d13-20020a50cd4d000000b0055eac41bb97si3405229edj.69.2024.01.30.00.33.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:33:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RirXi2tD; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-44138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44138-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id B9E441F29A92 for ; Tue, 30 Jan 2024 08:31:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F85E5821C; Tue, 30 Jan 2024 08:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RirXi2tD" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 D652F58208; Tue, 30 Jan 2024 08:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706603470; cv=none; b=FKHRBCyx1zMxszEOdwTrNQFhqdLCXMpsjt5Gi+p1DWf4K7GT8cAGhJtdjvAE1V2/g4XuAATEqP+XfxKfdu7jMjKpCiCHNN8PuJ+9l0D7ELRiouf/efR6xrYEXzF7npfi+3YN4Ka8xu4idlvxBuz4K9qe69cvSW3LylyrkZDbfPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706603470; c=relaxed/simple; bh=eDILxyTaa4HC4XR5/xnYTNtOe1gaCpqv7fIDLS+DWwA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AWde2R0aXcUBbEN63ggkeTL3oJ5w6AmmnvSIa6IZVIPUVVG3c1Fe0SbYKrwC1yzbVlAUs/cSCk4qkaMSj5RlEWP7ZA/+AHR0CyGcnKS2dVqZl/zRx35NA7JVQ7/rquib9vK7vGxr5hugdhLF9+NeLdWTH2WsOKSNgqF/utujJhg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RirXi2tD; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706603468; x=1738139468; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=eDILxyTaa4HC4XR5/xnYTNtOe1gaCpqv7fIDLS+DWwA=; b=RirXi2tDno8PxMbu8J4rVBcZOMtpKlD9NTvk6Li/ik9WX/1jLhPR6t/Q nmCZ8mL9+KuXX1WnIvHLbrrze0+0ZH3DByDW78TT+rgr6+OJt6qMj5DAL cnlocRLcteYurHZrjwk9i1tBUJoG6GNoEBiHxLawIqkSKdP3cbcBVahZC LsS1riqognM5ormI9a4dG/rcLPo1g8SmoEAd6SyUlOM0yhEeVeIcVADgM W+hL+miPH1PLLPnAh+haIzfX6/A2oyfctkMp84mczOaIBIJ7DgUBozeYK gLubwAeuEQUY9uZbZyg/YLWxfE1ZYpaSfd5BOSNSuQNznZWoJkC+FcLnF A==; X-IronPort-AV: E=McAfee;i="6600,9927,10968"; a="24686973" X-IronPort-AV: E=Sophos;i="6.05,707,1701158400"; d="scan'208";a="24686973" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 00:31:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10968"; a="737696481" X-IronPort-AV: E=Sophos;i="6.05,707,1701158400"; d="scan'208";a="737696481" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 00:31:05 -0800 Date: Tue, 30 Jan 2024 10:31:02 +0200 From: Raag Jadav To: Andy Shevchenko Cc: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, lakshmi.sowjanya.d@intel.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 2/3] pwm: dwc: simplify error handling Message-ID: References: <20240122030238.29437-1-raag.jadav@intel.com> <20240122030238.29437-3-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Jan 28, 2024 at 04:48:16PM +0200, Andy Shevchenko wrote: > On Mon, Jan 22, 2024 at 08:32:37AM +0530, Raag Jadav wrote: > > Simplify error handling in ->probe() function using dev_err_probe() helper. > > ... > > > ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci)); > > - if (ret) { > > - dev_err(dev, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret)); > > - return ret; > > - } > > + if (ret) > > + return dev_err_probe(dev, ret, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret)); > > > > base = pcim_iomap_table(pci)[0]; > > > - if (!base) { > > - dev_err(dev, "Base address missing\n"); > > - return -ENOMEM; > > - } > > + if (!base) > > + return dev_err_probe(dev, -ENOMEM, "Base address missing\n"); > > This check is bogus. Just remove it completely. > > The pcim_iomap_table() fails IFF pcim_iomap_regions() fails. > You have checked the latter already. I'm no expert on devres but I found a few NULL returns in alloc_dr() call path. In the interest of learning more about iomap, wouldn't we need to handle them (just in some odd case)? Raag