From patchwork Wed Oct 30 16:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13856846 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 09A752141AA; Wed, 30 Oct 2024 16:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730305220; cv=none; b=NujIX/csQ6Y7zQI04dMUBfsOw4k5aOLVqgZgxX7rZUrnrvrAhRBTs/NA1/XFnX1lcEwpooBNQcur/hyxk09xAd5AT9wz0HftvIGq066mLQdi/5/Bj9VBDG1zhlYpMJZSfYckxhitDKzaMia4m4zOUDlppg027FKCZ1gyJ4Jo1Us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730305220; c=relaxed/simple; bh=N8s35Qe2bx8CieRiI0UaDWB2QYYHwBkmDmOL1tMkXBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jRYya3MFtYQF8sWW4gCoA8ZDCHB4GU8l2S8uQWwaL5wxViimjzB45K0u9joMlqOqo8zPqa34cbYsKfswYYnP2cMOXD2KCMW5srEWsAkLIpSam9h/unw1TwojAPgu6kjB5MFvJZnC31B474e9YjQthf9W1ZpD2RiQqbxus0dk5es= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WJde8Tdj; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WJde8Tdj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730305219; x=1761841219; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N8s35Qe2bx8CieRiI0UaDWB2QYYHwBkmDmOL1tMkXBU=; b=WJde8TdjPWThNRM/49uGG0Ua/mbX2YpHDATD5m5+UcEIqQJa52kFl2SQ mKb+3+cu1UQ6GGwHBXcZEFwm696bsImdJpo6W+Wemu/G7J3HSbTerToW/ GnmPsHlAYD49UBe9fCRo2gMzzEAVqYA/IAb6cb/r9O8hQiIKCwSEXMkDf 2L+WfKkPNgm2Epg8J4HA+3fdEuOJlymo41KIuF2vQrfkg9b/MxhwtI6P6 Pq9ZxPry5darQKfUVd5tA17H7iMlBz0KFowhK14IjiKmdSmPbIm0KwcoH hogaLJWHFIJEEaBmAeujL4moPAnqQkAWuoVfkNGgcpbKoOM9gpjA0l/+K Q==; X-CSE-ConnectionGUID: 1qJ7TfPzTpe6qDQEbIc90w== X-CSE-MsgGUID: ubVUwaUlTWuBT1Ba5BYlRA== X-IronPort-AV: E=McAfee;i="6700,10204,11241"; a="30230402" X-IronPort-AV: E=Sophos;i="6.11,245,1725346800"; d="scan'208";a="30230402" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2024 09:20:18 -0700 X-CSE-ConnectionGUID: tMHAJnt9SRC7gjjATOkhZw== X-CSE-MsgGUID: QP6RjMU0Q7GTLORfzNVxEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,245,1725346800"; d="scan'208";a="82459067" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa009.fm.intel.com with ESMTP; 30 Oct 2024 09:20:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0575B1CF; Wed, 30 Oct 2024 18:20:14 +0200 (EET) From: Andy Shevchenko To: Marcelo Schmitt , Andy Shevchenko , Jonathan Cameron , Matteo Martelli , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 1/2] iio: adc: ad4000: Check for error code from devm_mutex_init() call Date: Wed, 30 Oct 2024 18:19:18 +0200 Message-ID: <20241030162013.2100253-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241030162013.2100253-1-andriy.shevchenko@linux.intel.com> References: <20241030162013.2100253-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Even if it's not critical, the avoidance of checking the error code from devm_mutex_init() call today diminishes the point of using devm variant of it. Tomorrow it may even leak something. Add the missed check. Fixes: 938fd562b974 ("iio: adc: Add support for AD4000") Signed-off-by: Andy Shevchenko --- drivers/iio/adc/ad4000.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad4000.c b/drivers/iio/adc/ad4000.c index 6ea491245084..b4a23c97ee52 100644 --- a/drivers/iio/adc/ad4000.c +++ b/drivers/iio/adc/ad4000.c @@ -637,7 +637,9 @@ static int ad4000_probe(struct spi_device *spi) indio_dev->name = chip->dev_name; indio_dev->num_channels = 1; - devm_mutex_init(dev, &st->lock); + ret = devm_mutex_init(dev, &st->lock); + if (ret) + return ret; st->gain_milli = 1000; if (chip->has_hardware_gain) { From patchwork Wed Oct 30 16:19:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13856847 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 06A36214422; Wed, 30 Oct 2024 16:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730305222; cv=none; b=ergZoxfpzLQ/MYAdy8kKQXp+YSTQdXjb2WURCShpF9+mnLTcUzvkvMpTLpL6EP2V6z6DMNes/66F2UZjh7zG2En8awz9hUxNXuQq4P0aHwhndbEUHXCajei0QeZNotHns+jWe8Vvu0br+wglvk53v9sJm1tyBfHAqk3sXJZNCYQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730305222; c=relaxed/simple; bh=gq65YC2ykZCricT7yy2SZsU7hVBxbLZf9QS6ITu3/HY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=shKLkE/HYfTgf2j4keU9z7ZdnjuFL0CUuwtt+D46pM00Wfz0nb+Bqb2pVAjzV+NpZxX4YVuE5K1RkO7vNDsaDmjtU2IBo9q/SI6YzvyQFf/cpe/Dn2aRCt/EJishSRWwNEk6kNXYnIML/wkNRJSGMDI7TyMhqJeSe2FIN96Br94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ut6NdegY; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ut6NdegY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730305221; x=1761841221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gq65YC2ykZCricT7yy2SZsU7hVBxbLZf9QS6ITu3/HY=; b=Ut6NdegYM8ea1d5ZHXgdymf/r2ldh1Tc8DUVjM5liq6IF8e75az4mvLK SWTLQFoWcnn6c4uJVJc24u7LlVBJDpdixGTWaX5gF/IxEh72BWfg6sQab WZI04QvQW6ig2aQjs6nqm1OzE1VRtT7LKkEBVCZq4B8QxyqcyG2f4ePAF jNJuQjqhhwexQPylT1YKTrP0B5tnkJGPaJxqd+RyL2EUZgtxRfnogJXDo ZeM/rK/hWimkobsIh4rgS1FEFvOAdjcgWtaWiZgzbKSEqmpm69ypa0LQq 7EMQJGm5CemdrwKtCzrVEFQXVpaaoCaCy1msrFLNfiuT/2nQo7t2SbpqH A==; X-CSE-ConnectionGUID: ocjc6wBNSB+r59ajz/IiFQ== X-CSE-MsgGUID: MUA8IqMKR0+D3qK0ZSiQ5Q== X-IronPort-AV: E=McAfee;i="6700,10204,11241"; a="30230408" X-IronPort-AV: E=Sophos;i="6.11,245,1725346800"; d="scan'208";a="30230408" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2024 09:20:18 -0700 X-CSE-ConnectionGUID: H88prCWESV+Ls/PowtpH3w== X-CSE-MsgGUID: X4zhELxOQ0CNI0eLPUHU7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,245,1725346800"; d="scan'208";a="82459068" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa009.fm.intel.com with ESMTP; 30 Oct 2024 09:20:16 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0EE3A2A0; Wed, 30 Oct 2024 18:20:15 +0200 (EET) From: Andy Shevchenko To: Marcelo Schmitt , Andy Shevchenko , Jonathan Cameron , Matteo Martelli , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 2/2] iio: adc: pac1921: Check for error code from devm_mutex_init() call Date: Wed, 30 Oct 2024 18:19:19 +0200 Message-ID: <20241030162013.2100253-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241030162013.2100253-1-andriy.shevchenko@linux.intel.com> References: <20241030162013.2100253-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Even if it's not critical, the avoidance of checking the error code from devm_mutex_init() call today diminishes the point of using devm variant of it. Tomorrow it may even leak something. Add the missed check. Fixes: 371f778b83cd ("iio: adc: add support for pac1921") Signed-off-by: Andy Shevchenko Acked-by: Matteo Martelli --- drivers/iio/adc/pac1921.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c index f6f8f9122a78..385e86ecc441 100644 --- a/drivers/iio/adc/pac1921.c +++ b/drivers/iio/adc/pac1921.c @@ -1132,7 +1132,9 @@ static int pac1921_probe(struct i2c_client *client) return dev_err_probe(dev, PTR_ERR(priv->regmap), "Cannot initialize register map\n"); - devm_mutex_init(dev, &priv->lock); + ret = devm_mutex_init(dev, &priv->lock); + if (ret) + return ret; priv->dv_gain = PAC1921_DEFAULT_DV_GAIN; priv->di_gain = PAC1921_DEFAULT_DI_GAIN;