From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA3E0C433EF for ; Tue, 19 Jul 2022 10:35:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3D6F816C5; Tue, 19 Jul 2022 12:34:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3D6F816C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658226949; bh=NYsbvGwWgrPYMQm7Q/jE5pHPJf2ZCxt84yxKVAFtZM0=; h=From:To:Subject:Date:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KKzNhCdFPYtydohtJd3yt4IF+xK6bsj+yVrf5xxYTPI4JEUOtXmWW/jXQ6iCjfx1j 9k/JHWm607ImWbpzyJgFDVabbdG2Gmkmy7J1eA1bhvs+sQelX9vy8tGO0wTp9EijRw LW5Q5rrs9Pa34vN1cHMRJHpZ7huiMOOqmFqq6vpQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AC928F8016D; Tue, 19 Jul 2022 12:34:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3E837F801EC; Tue, 19 Jul 2022 12:34:56 +0200 (CEST) Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2F87BF80118 for ; Tue, 19 Jul 2022 12:34:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F87BF80118 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-153-WfVlpVyTM_qbYoROTtpk1A-1; Tue, 19 Jul 2022 11:34:46 +0100 X-MC-Unique: WfVlpVyTM_qbYoROTtpk1A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Tue, 19 Jul 2022 11:34:45 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.036; Tue, 19 Jul 2022 11:34:45 +0100 From: David Laight To: 'Mark Brown' Subject: RE: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Topic: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Index: AQHYm1RF9VBLG0gK5ky/ItlmeeUnS62FdfSA///0CICAABRvQA== Date: Tue, 19 Jul 2022 10:34:44 +0000 Message-ID: <20cfcc8e59a74166846cff028cd2c4e8@AcuMS.aculab.com> References: <1658222864-25378-1-git-send-email-shengjiu.wang@nxp.com> <1658222864-25378-3-git-send-email-shengjiu.wang@nxp.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "Xiubo.Lee@gmail.com" , "shengjiu.wang@gmail.com" , 'Shengjiu Wang' , "tiwai@suse.com" , "lgirdwood@gmail.com" , "nicoleotsuka@gmail.com" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Mark Brown > Sent: 19 July 2022 11:17 >=20 > On Tue, Jul 19, 2022 at 10:01:54AM +0000, David Laight wrote: > > From: Shengjiu Wang >=20 > > > -=09ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_f= ormat); > > > +=09ret =3D of_property_read_u32(np, "fsl,asrc-format", (u32 *)&asrc-= >asrc_format); >=20 > > Ugg, you really shouldn't need to do that. > > It means that something is badly wrong somewhere. > > Casting pointers to integer types is just asking for a bug. >=20 > That's casting one pointer type to another pointer type. It is casting the address of some type to a 'u32 *'. This will then be dereferenced by the called function. So the original type better be 32 bits. I'm also guessing that sparse was complaining about endianness? It isn't at all clear that these casts actually fix it. (Mark: You'll be glad to hear that the office aircon is broken again - two weeks lead time on the spare part.) =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB7B7C43334 for ; Tue, 19 Jul 2022 10:35:18 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LnFb920dBz2yQj for ; Tue, 19 Jul 2022 20:35:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=aculab.com (client-ip=185.58.86.151; helo=eu-smtp-delivery-151.mimecast.com; envelope-from=david.laight@aculab.com; receiver=) Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LnFZj2StHz2xkr for ; Tue, 19 Jul 2022 20:34:52 +1000 (AEST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-153-WfVlpVyTM_qbYoROTtpk1A-1; Tue, 19 Jul 2022 11:34:46 +0100 X-MC-Unique: WfVlpVyTM_qbYoROTtpk1A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Tue, 19 Jul 2022 11:34:45 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.036; Tue, 19 Jul 2022 11:34:45 +0100 From: David Laight To: 'Mark Brown' Subject: RE: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Topic: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Index: AQHYm1RF9VBLG0gK5ky/ItlmeeUnS62FdfSA///0CICAABRvQA== Date: Tue, 19 Jul 2022 10:34:44 +0000 Message-ID: <20cfcc8e59a74166846cff028cd2c4e8@AcuMS.aculab.com> References: <1658222864-25378-1-git-send-email-shengjiu.wang@nxp.com> <1658222864-25378-3-git-send-email-shengjiu.wang@nxp.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "Xiubo.Lee@gmail.com" , "shengjiu.wang@gmail.com" , 'Shengjiu Wang' , "tiwai@suse.com" , "lgirdwood@gmail.com" , "perex@perex.cz" , "nicoleotsuka@gmail.com" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Mark Brown > Sent: 19 July 2022 11:17 >=20 > On Tue, Jul 19, 2022 at 10:01:54AM +0000, David Laight wrote: > > From: Shengjiu Wang >=20 > > > -=09ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_f= ormat); > > > +=09ret =3D of_property_read_u32(np, "fsl,asrc-format", (u32 *)&asrc-= >asrc_format); >=20 > > Ugg, you really shouldn't need to do that. > > It means that something is badly wrong somewhere. > > Casting pointers to integer types is just asking for a bug. >=20 > That's casting one pointer type to another pointer type. It is casting the address of some type to a 'u32 *'. This will then be dereferenced by the called function. So the original type better be 32 bits. I'm also guessing that sparse was complaining about endianness? It isn't at all clear that these casts actually fix it. (Mark: You'll be glad to hear that the office aircon is broken again - two weeks lead time on the spare part.) =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4870C433EF for ; Tue, 19 Jul 2022 10:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237271AbiGSKex convert rfc822-to-8bit (ORCPT ); Tue, 19 Jul 2022 06:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbiGSKev (ORCPT ); Tue, 19 Jul 2022 06:34:51 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCB623FA28 for ; Tue, 19 Jul 2022 03:34:49 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-153-WfVlpVyTM_qbYoROTtpk1A-1; Tue, 19 Jul 2022 11:34:46 +0100 X-MC-Unique: WfVlpVyTM_qbYoROTtpk1A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Tue, 19 Jul 2022 11:34:45 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.036; Tue, 19 Jul 2022 11:34:45 +0100 From: David Laight To: 'Mark Brown' CC: 'Shengjiu Wang' , "shengjiu.wang@gmail.com" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "nicoleotsuka@gmail.com" , "lgirdwood@gmail.com" , "perex@perex.cz" , "tiwai@suse.com" , "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Topic: [PATCH -next 2/5] ASoC: fsl_asrc: force cast the asrc_format type Thread-Index: AQHYm1RF9VBLG0gK5ky/ItlmeeUnS62FdfSA///0CICAABRvQA== Date: Tue, 19 Jul 2022 10:34:44 +0000 Message-ID: <20cfcc8e59a74166846cff028cd2c4e8@AcuMS.aculab.com> References: <1658222864-25378-1-git-send-email-shengjiu.wang@nxp.com> <1658222864-25378-3-git-send-email-shengjiu.wang@nxp.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown > Sent: 19 July 2022 11:17 > > On Tue, Jul 19, 2022 at 10:01:54AM +0000, David Laight wrote: > > From: Shengjiu Wang > > > > - ret = of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_format); > > > + ret = of_property_read_u32(np, "fsl,asrc-format", (u32 *)&asrc->asrc_format); > > > Ugg, you really shouldn't need to do that. > > It means that something is badly wrong somewhere. > > Casting pointers to integer types is just asking for a bug. > > That's casting one pointer type to another pointer type. It is casting the address of some type to a 'u32 *'. This will then be dereferenced by the called function. So the original type better be 32 bits. I'm also guessing that sparse was complaining about endianness? It isn't at all clear that these casts actually fix it. (Mark: You'll be glad to hear that the office aircon is broken again - two weeks lead time on the spare part.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)