linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: mv64xxx: Fix check for missing clock
@ 2021-02-08  6:19 Samuel Holland
  2021-02-09 10:42 ` Wolfram Sang
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Holland @ 2021-02-08  6:19 UTC (permalink / raw)
  To: Gregory CLEMENT, Wolfram Sang, linux-i2c
  Cc: linux-kernel, Samuel Holland, Dan Carpenter

In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
pointers to optional clocks were replaced by NULL to simplify the resume
callback implementation. However, that commit missed that the IS_ERR
check in mv64xxx_of_config should be replaced with a NULL check. As a
result, the check always passes, even for an invalid device tree.

Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index b03c344323d1..c590d36b5fd1 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -813,7 +813,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
 	 * need to know tclk in order to calculate bus clock
 	 * factors.
 	 */
-	if (IS_ERR(drv_data->clk)) {
+	if (!drv_data->clk) {
 		rc = -ENODEV;
 		goto out;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08  6:19 [PATCH] i2c: mv64xxx: Fix check for missing clock Samuel Holland
@ 2021-02-09 10:42 ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2021-02-09 10:42 UTC (permalink / raw)
  To: Samuel Holland; +Cc: Gregory CLEMENT, linux-i2c, linux-kernel, Dan Carpenter

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

On Mon, Feb 08, 2021 at 12:19:22AM -0600, Samuel Holland wrote:
> In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
> pointers to optional clocks were replaced by NULL to simplify the resume
> callback implementation. However, that commit missed that the IS_ERR
> check in mv64xxx_of_config should be replaced with a NULL check. As a
> result, the check always passes, even for an invalid device tree.
> 
> Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Added "RPM" to $subject and applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08 13:20     ` Andrew Lunn
@ 2021-02-09  3:05       ` Samuel Holland
  0 siblings, 0 replies; 7+ messages in thread
From: Samuel Holland @ 2021-02-09  3:05 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Jakub Kicinski, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Corentin Labbe, Ondrej Jirman, netdev,
	linux-arm-kernel, linux-kernel, linux-sunxi, Dan Carpenter

On 2/8/21 7:20 AM, Andrew Lunn wrote:
> On Mon, Feb 08, 2021 at 12:31:34AM -0600, Samuel Holland wrote:
>> On 2/8/21 12:28 AM, Samuel Holland wrote:
>>> In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
>>> pointers to optional clocks were replaced by NULL to simplify the resume
>>> callback implementation. However, that commit missed that the IS_ERR
>>> check in mv64xxx_of_config should be replaced with a NULL check. As a
>>> result, the check always passes, even for an invalid device tree.
>>
>> Sorry, please ignore this unrelated patch. I accidentally copied it to
>> the wrong directory before sending this series.
> 
> Hi Samuel
> 
> This patch looks correct. But i don't see it in i2c/for-next, where as
> e5c02cf54154 is. I just want to make sure it does not get lost...

Thanks for the concern. I had already sent it separately[0], to the
appropriate maintainers, so this submission was a duplicate.

Cheers,
Samuel

[0]:
https://lore.kernel.org/lkml/20210208061922.10073-1-samuel@sholland.org/

> 	     Andrew
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08  6:31   ` Samuel Holland
  2021-02-08 13:20     ` Andrew Lunn
@ 2021-02-08 21:11     ` Jakub Kicinski
  1 sibling, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-02-08 21:11 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Corentin Labbe, Ondrej Jirman, netdev, linux-arm-kernel,
	linux-kernel, linux-sunxi, Dan Carpenter

On Mon, 8 Feb 2021 00:31:34 -0600 Samuel Holland wrote:
> On 2/8/21 12:28 AM, Samuel Holland wrote:
> > In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
> > pointers to optional clocks were replaced by NULL to simplify the resume
> > callback implementation. However, that commit missed that the IS_ERR
> > check in mv64xxx_of_config should be replaced with a NULL check. As a
> > result, the check always passes, even for an invalid device tree.  
> 
> Sorry, please ignore this unrelated patch. I accidentally copied it to
> the wrong directory before sending this series.

Unfortunately patchwork decided to take this patch in instead of the
real 1/5 patch. Please make a clean repost even if there are no review
comments to address.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08  6:31   ` Samuel Holland
@ 2021-02-08 13:20     ` Andrew Lunn
  2021-02-09  3:05       ` Samuel Holland
  2021-02-08 21:11     ` Jakub Kicinski
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2021-02-08 13:20 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Jakub Kicinski, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Corentin Labbe, Ondrej Jirman, netdev,
	linux-arm-kernel, linux-kernel, linux-sunxi, Dan Carpenter

On Mon, Feb 08, 2021 at 12:31:34AM -0600, Samuel Holland wrote:
> On 2/8/21 12:28 AM, Samuel Holland wrote:
> > In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
> > pointers to optional clocks were replaced by NULL to simplify the resume
> > callback implementation. However, that commit missed that the IS_ERR
> > check in mv64xxx_of_config should be replaced with a NULL check. As a
> > result, the check always passes, even for an invalid device tree.
> 
> Sorry, please ignore this unrelated patch. I accidentally copied it to
> the wrong directory before sending this series.

Hi Samuel

This patch looks correct. But i don't see it in i2c/for-next, where as
e5c02cf54154 is. I just want to make sure it does not get lost...

	     Andrew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08  6:28 ` [PATCH] i2c: mv64xxx: Fix check for missing clock Samuel Holland
@ 2021-02-08  6:31   ` Samuel Holland
  2021-02-08 13:20     ` Andrew Lunn
  2021-02-08 21:11     ` Jakub Kicinski
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Holland @ 2021-02-08  6:31 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Jakub Kicinski, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Corentin Labbe
  Cc: Ondrej Jirman, netdev, linux-arm-kernel, linux-kernel,
	linux-sunxi, Dan Carpenter

On 2/8/21 12:28 AM, Samuel Holland wrote:
> In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
> pointers to optional clocks were replaced by NULL to simplify the resume
> callback implementation. However, that commit missed that the IS_ERR
> check in mv64xxx_of_config should be replaced with a NULL check. As a
> result, the check always passes, even for an invalid device tree.

Sorry, please ignore this unrelated patch. I accidentally copied it to
the wrong directory before sending this series.

Samuel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] i2c: mv64xxx: Fix check for missing clock
  2021-02-08  6:28 [PATCH net-next RESEND 0/5] dwmac-sun8i cleanup and shutdown hook Samuel Holland
@ 2021-02-08  6:28 ` Samuel Holland
  2021-02-08  6:31   ` Samuel Holland
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Holland @ 2021-02-08  6:28 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Jakub Kicinski, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Corentin Labbe
  Cc: Ondrej Jirman, netdev, linux-arm-kernel, linux-kernel,
	linux-sunxi, Samuel Holland, Dan Carpenter

In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error
pointers to optional clocks were replaced by NULL to simplify the resume
callback implementation. However, that commit missed that the IS_ERR
check in mv64xxx_of_config should be replaced with a NULL check. As a
result, the check always passes, even for an invalid device tree.

Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index b03c344323d1..c590d36b5fd1 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -813,7 +813,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
 	 * need to know tclk in order to calculate bus clock
 	 * factors.
 	 */
-	if (IS_ERR(drv_data->clk)) {
+	if (!drv_data->clk) {
 		rc = -ENODEV;
 		goto out;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-09 10:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  6:19 [PATCH] i2c: mv64xxx: Fix check for missing clock Samuel Holland
2021-02-09 10:42 ` Wolfram Sang
2021-02-08  6:28 [PATCH net-next RESEND 0/5] dwmac-sun8i cleanup and shutdown hook Samuel Holland
2021-02-08  6:28 ` [PATCH] i2c: mv64xxx: Fix check for missing clock Samuel Holland
2021-02-08  6:31   ` Samuel Holland
2021-02-08 13:20     ` Andrew Lunn
2021-02-09  3:05       ` Samuel Holland
2021-02-08 21:11     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).