Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp2349842rwl; Sat, 5 Nov 2022 05:47:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fZ+cvB1kiPLV14BrPDdwGSpEIwaBpRqXrFapuP/Y7YE1On+ym1Bgu6j3dBMWrirVsnuwV X-Received: by 2002:a17:90b:1950:b0:212:de19:b3ce with SMTP id nk16-20020a17090b195000b00212de19b3cemr40691540pjb.16.1667652423652; Sat, 05 Nov 2022 05:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667652423; cv=none; d=google.com; s=arc-20160816; b=B/+cvrp1D5KZjpymclRhsuZz+13cENwMs6DV41IpV3RwoCCpRhYx2XSGNNgunWAqEk 67o+9uLI9uOtPxBO2UDrqtwBcoOzpAd8o67gJs1ucCXi7+I3FNgQtFREoNkIjMwc0Xqi KmSCK9rwl801qtbX7gtjDYdiIeCozNXJXPBn+jb2ql+qqF0VbyrhA921AW8ExfR+jLqz Vw+iRAUMmlxCSZmF3m74zwu8w5pXVT/GYXlxaKIsDIm+4A9W8vld8m6AxyK5Kvb4KgMl k3zWxdHluagmBI2452iGkSCU4ekn5aO8BsBJ3SD4NZojdTj0vrUyJj1HVJ0ZWH+kCMMt vZww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=GtMx5VstEy61vrzIUASE+KC+AT3zTaHsHrHD2w3tP/k=; b=dUaoqvtoBNKpX1IqO2ExaajZkBPc3Al+lFnfJOGUN5MjG+bVnFkWJdhGXUWJ8t+31p t21NkdFDMrhx8XSHen0RdrKxPZ0lAv+t9MnR214J1XYeIp1wGOxQ4iCcOl8Eu3cFUCeF KVvcRcvNZ8i4zrmmmkL4ZlAyyyVD6+o+lzP+sphQ8XNEeeZ2DzgJpHbxT2+iWgvs/nCI UlFqHpVwZIrvTCOGlfE1rgb45vArFjU4yvWlsjUxnxn7cVtcu4FimLyMQqGV4RRS4GhD DIkvoB9F3hjV3Oxlp84mvnZ5kneZTfsrYglT1z2m4g8sXIjnTU8qnf0cu9FctiQO5hbg uZ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailoo.org header.s=mailo header.b=HucCY67V; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailoo.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a170903234600b00176b7b8cf2esi3794988plh.586.2022.11.05.05.46.24; Sat, 05 Nov 2022 05:47:03 -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=fail header.i=@mailoo.org header.s=mailo header.b=HucCY67V; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailoo.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbiKEMiQ (ORCPT + 97 others); Sat, 5 Nov 2022 08:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbiKEMiO (ORCPT ); Sat, 5 Nov 2022 08:38:14 -0400 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D70615726 for ; Sat, 5 Nov 2022 05:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailoo.org; s=mailo; t=1667651877; bh=GtMx5VstEy61vrzIUASE+KC+AT3zTaHsHrHD2w3tP/k=; h=X-EA-Auth:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:MIME-Version; b=HucCY67VaIu0on7RDF1CjxBYyZ5K4fOsh1jre9HaWPUEGCFupceKfrvOaTKUnvi9v VfhwgyUFrP2mruGMF6aFK2TvlJgMm5RmhG88WnWKrMNaqpnJh2bc19cLChHFSWxS9W WlnsAxtVEV6/CsCWlwQevZ/Ycj/r0vfSQkARp26M= Received: by b-2.in.mailobj.net [192.168.90.12] with ESMTP via proxy.mailoo.org [213.182.55.207] Sat, 5 Nov 2022 13:37:57 +0100 (CET) X-EA-Auth: UMfo2Qe/JnqzwN5ERAoWxYpcmCoJbQswsmnrVgTU93l0comRXwpP3OSZeJ6Ema/mzBFBynJuA581D2XsSp12iwPkcKsCi/xeqW5+fQUaf6A= Message-ID: <5f1a31ba4a53f8461bad7747ae09e73fcfe0af1c.camel@mailoo.org> Subject: Re: [PATCH v1 1/1] leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest() From: Vincent Knecht To: Andy Shevchenko , Pavel Machek , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: Nathan Chancellor , Nick Desaulniers , Tom Rix , kernel test robot Date: Sat, 05 Nov 2022 13:37:55 +0100 In-Reply-To: <20221104235940.74044-1-andriy.shevchenko@linux.intel.com> References: <20221104235940.74044-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org Le samedi 05 novembre 2022 =C3=A0 01:59 +0200, Andy Shevchenko a =C3=A9crit= =C2=A0: > Clang complains that devm_add_action() takes a parameter with a wrong typ= e: >=20 > warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' conve= rts to incompatible function type [-Wcast- > function-type-strict] > =C2=A0=C2=A0=C2=A0 err =3D devm_add_action(dev, (void (*)(void *))mutex_d= estroy, &is31->lock); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > =C2=A0=C2=A0=C2=A0 1 warning generated. >=20 > 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 > =C2=A0 devm_add_action() call by unknown reason > - strictly speaking the parameter is not compatible by type >=20 > Fix both issues by switching to devm_add_action_or_reset() and adding a > wrapper for mutex_destroy() call. >=20 > Reported-by: kernel test robot > Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering") > Signed-off-by: Andy Shevchenko > --- > =C2=A0drivers/leds/leds-is31fl319x.c | 7 ++++++- > =C2=A01 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319= x.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) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return dezibel / IS31FL31= 96_AUDIO_GAIN_DB_STEP; > =C2=A0} > =C2=A0 > +static void is31f1319x_mutex_destroy(void *lock) > +{ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mutex_destroy(lock); > +} > + > =C2=A0static int is31fl319x_probe(struct i2c_client *client) > =C2=A0{ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct is31fl319x_chip *i= s31; > @@ -510,7 +515,7 @@ static int is31fl319x_probe(struct i2c_client *client= ) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -ENOMEM; > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mutex_init(&is31->lock); > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0err =3D devm_add_action(dev, (= void (*)(void *))mutex_destroy, &is31->lock); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0err =3D devm_add_action_or_res= et(dev, is31f1319x_mutex_destroy, &is31->lock); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (err) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return err; > =C2=A0 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