Message ID | 20221104235940.74044-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp710430wru; Fri, 4 Nov 2022 17:02:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5860mBGcQVLspFaw2V1Au5QVZLY2SBV/Zne8qQisPShPkBuXHKPeous9kXPPpR+51s/f5A X-Received: by 2002:a17:902:f7d4:b0:188:505b:529 with SMTP id h20-20020a170902f7d400b00188505b0529mr12553940plw.173.1667606522778; Fri, 04 Nov 2022 17:02:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667606522; cv=none; d=google.com; s=arc-20160816; b=G6dKu1o6hBdw1bNLax0/ZT3679sr6sid6Znyd4uKiJ+qD02vTBF2f23AmaFuuItBaK 1WckDaXjAlDnadxLlKkT/UAXxzYMxMPUi27xvVsCtb485kIsz3u0cVh2ndCxgcpJIYEF Kkl0KEo3U8mSf7vHgwwsO0L9Qo68l1RB1ytaF0rkyILcnUrUodghSzdPYbAL6DOZUGig Q+Vizevsa+sF0JFCky2kvtejBfLUzPMk2AVybpBk4cqF+9yw+y27I4xsGNXynG7YYfJ5 SDIFgLVyllVuX6E5VpkChvmukgwqW74PVelm4/bpj2Qf5xd5GLpfcTDSAagSphN6omRX prig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6t6+x7nnFsFH55TJyi+YUqDeT4TPwi5Dv2WzD2vQQ1k=; b=U932cr+3JT5gIqmgN25IERKj0g8jI/m2huMSN1DbjRsIuqniL2CrPlCgQMUh/92BCr Rjq3s4YCdvzfx2TsQnXGPagtwkiym9yW+K+4TvDzIqb7EbMrjRsBNoK88kw0hQwtLBcI RwQYdBfcCG4fAo3Vo9rsuTDsiZfc97cBS/febgO+jW2xk/sFZt9iP7G0UNriw7JMqRAH TL4512tjI5/M2XYstKhxKSYA76U7Psw7z2k50gn2t9PZevMucCyHoWr2GU40Mn7VRsXv Afav79FPctAKJSCPxExamZu0tGWyHYDUB6u1P9Srq72bSx6brmdFiJBKmzAIEEIjMhg0 4sig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CW18EgI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j186-20020a638bc3000000b00460358671e2si1013260pge.547.2022.11.04.17.01.48; Fri, 04 Nov 2022 17:02:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CW18EgI9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbiKDX71 (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Fri, 4 Nov 2022 19:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiKDX7Z (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Nov 2022 19:59:25 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8955E4298C; Fri, 4 Nov 2022 16:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667606364; x=1699142364; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hbMbA2gtORlmZXrbEO3nvATlX8xycbXUes0wIx18t3s=; b=CW18EgI9otytfue6OMiFIbx32E9WIYOpY+Wv//GsD6M3Wr7LhYeVEOQ0 j/o3XAzfhncp+GsPryZXe+lQ2+Xyryzdih6Kmmn4KfhiFaKbGVnNL/7MT j1B4Cs87qsnPiBbZV4l3Jq4PfOVJ98tYNYk9ux04ymUmFqNECKaVUl77c c8wwcZfDDCPlLLptZrE3ys903bbA6GH2DL9maps89eXcS2gtlP52XXebk jZ088BMoY9/PjklETP3eAHWjVGMSIz2W89a4TPm0+6Jk2dtvn8OejPhTa u3e+vFv8GtSIFNPPkcxcY6yJWynEIdts0thCntc2ot+784WVQIVTr/5Ir A==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="311222392" X-IronPort-AV: E=Sophos;i="5.96,139,1665471600"; d="scan'208";a="311222392" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 16:59:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="880470963" X-IronPort-AV: E=Sophos;i="5.96,139,1665471600"; d="scan'208";a="880470963" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 04 Nov 2022 16:59:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C79D6F7; Sat, 5 Nov 2022 01:59:44 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Vincent Knecht <vincent.knecht@mailoo.org>, Pavel Machek <pavel@ucw.cz>, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, kernel test robot <lkp@intel.com> Subject: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest() Date: Sat, 5 Nov 2022 01:59:40 +0200 Message-Id: <20221104235940.74044-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748612177006491774?= X-GMAIL-MSGID: =?utf-8?q?1748612177006491774?= |
Series |
[v1,1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
|
|
Commit Message
Andy Shevchenko
Nov. 4, 2022, 11:59 p.m. UTC
Clang complains that devm_add_action() takes a parameter with a wrong type:
warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict]
err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs.
non-devm ordering") missed two things:
- while mention devm_add_action_or_reset() the actual change got
devm_add_action() call by unknown reason
- strictly speaking the parameter is not compatible by type
Fix both issues by switching to devm_add_action_or_reset() and adding a
wrapper for mutex_destroy() call.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/leds/leds-is31fl319x.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
Le samedi 05 novembre 2022 à 01:59 +0200, Andy Shevchenko a écrit : > Clang complains that devm_add_action() takes a parameter with a wrong type: > > warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast- > function-type-strict] > err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 warning generated. > > It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs. > non-devm ordering") missed two things: > - while mention devm_add_action_or_reset() the actual change got > devm_add_action() call by unknown reason > - strictly speaking the parameter is not compatible by type > > Fix both issues by switching to devm_add_action_or_reset() and adding a > wrapper for mutex_destroy() call. > > Reported-by: kernel test robot <lkp@intel.com> > Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/leds/leds-is31fl319x.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c > index 52b59b62f437..6f94ad83e066 100644 > --- a/drivers/leds/leds-is31fl319x.c > +++ b/drivers/leds/leds-is31fl319x.c > @@ -494,6 +494,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel) > return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP; > } > > +static void is31f1319x_mutex_destroy(void *lock) > +{ > + mutex_destroy(lock); > +} > + > static int is31fl319x_probe(struct i2c_client *client) > { > struct is31fl319x_chip *is31; > @@ -510,7 +515,7 @@ static int is31fl319x_probe(struct i2c_client *client) > return -ENOMEM; > > mutex_init(&is31->lock); > - err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); > + err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock); > if (err) > return err; > LED still works fine after applying this patch, also after rmmod'ing and modprobe'ing again. Please let me know if something else should be tested. Thank you ! Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
On Sat, Nov 05, 2022 at 01:37:55PM +0100, Vincent Knecht wrote: > Le samedi 05 novembre 2022 à 01:59 +0200, Andy Shevchenko a écrit : ... > LED still works fine after applying this patch, > also after rmmod'ing and modprobe'ing again. > Please let me know if something else should be tested. > Thank you ! Thank you very much for testing, I believe it's comprehensive what you have done already. > Tested-by: Vincent Knecht <vincent.knecht@mailoo.org>
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c index 52b59b62f437..6f94ad83e066 100644 --- a/drivers/leds/leds-is31fl319x.c +++ b/drivers/leds/leds-is31fl319x.c @@ -494,6 +494,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel) return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP; } +static void is31f1319x_mutex_destroy(void *lock) +{ + mutex_destroy(lock); +} + static int is31fl319x_probe(struct i2c_client *client) { struct is31fl319x_chip *is31; @@ -510,7 +515,7 @@ static int is31fl319x_probe(struct i2c_client *client) return -ENOMEM; mutex_init(&is31->lock); - err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); + err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock); if (err) return err;