[PATCH v2 1/4] pinctrl: s32: use of_device_get_match_data() to get device data
Andy Shevchenko
andy.shevchenko at gmail.com
Tue Mar 21 00:32:32 PDT 2023
On Tue, Mar 21, 2023 at 6:44 AM Chester Lin <clin at suse.com> wrote:
> On Mon, Mar 20, 2023 at 06:59:41PM +0200, Andy Shevchenko wrote:
> > On Mon, Mar 20, 2023 at 6:39 PM Chester Lin <clin at suse.com> wrote:
...
> > > + soc_info = (struct s32_pinctrl_soc_info *)
> > > + of_device_get_match_data(&pdev->dev);
> >
> > Drop the ugly casting, it's not needed.
>
> Actually it's used for suppressing the compiler warning since some members in
> this soc_info need to be filled by pinctrl-s32cc.
Yes, that's one way to solve this.
...
> + info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return -ENOMEM;
> +
> + memcpy(info, soc_data, sizeof(*info));
Right, but use devm_kmemdup() instead.
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list