Message ID | 20180807171940.150507-1-mka@chromium.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2] ASoC: rt5677: Fix initialization of rt5677_of_match.data | expand |
On Tue, 2018-08-07 at 10:19 -0700, Matthias Kaehlcke wrote: > The driver expects to find the device id in rt5677_of_match.data, > however > it is currently assigned to rt5677_of_match.type. Fix this. > > The problem was found with the help of clang: > sound/soc/codecs/rt5677.c:5010:36: warning: expression which > evaluates to > zero treated as a null pointer constant of type 'const void *' > [-Wnon-literal-null-conversion] > { .compatible = "realtek,rt5677", RT5677 }, > ^~~~~~ > > Fixes: ddc9e69b9dc2 ("ASoC: rt5677: Hide platform data in the module > sources") > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> While this is correct fix, it seems it was never used. Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > static const struct of_device_id rt5677_of_match[] = { > - { .compatible = "realtek,rt5677", RT5677 }, > + { .compatible = "realtek,rt5677", .data = (const void *)RT5677 > }, > { } > }; > MODULE_DEVICE_TABLE(of, rt5677_of_match);
On Tue, Aug 07, 2018 at 10:13:47PM +0300, Andy Shevchenko wrote: > On Tue, 2018-08-07 at 10:19 -0700, Matthias Kaehlcke wrote: > > The driver expects to find the device id in rt5677_of_match.data, > > however > > it is currently assigned to rt5677_of_match.type. Fix this. > > > > The problem was found with the help of clang: > > sound/soc/codecs/rt5677.c:5010:36: warning: expression which > > evaluates to > > zero treated as a null pointer constant of type 'const void *' > > [-Wnon-literal-null-conversion] > > { .compatible = "realtek,rt5677", RT5677 }, > > ^~~~~~ > > > > Fixes: ddc9e69b9dc2 ("ASoC: rt5677: Hide platform data in the module > > sources") > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > > While this is correct fix, it seems it was never used. Or it was used but no problem was noticed because .data was already 0, which happens to be the value of RT5677. > Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks Matthias
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 8a0181a2db08..47feef30dadb 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -5007,7 +5007,7 @@ static const struct regmap_config rt5677_regmap = { }; static const struct of_device_id rt5677_of_match[] = { - { .compatible = "realtek,rt5677", RT5677 }, + { .compatible = "realtek,rt5677", .data = (const void *)RT5677 }, { } }; MODULE_DEVICE_TABLE(of, rt5677_of_match);
The driver expects to find the device id in rt5677_of_match.data, however it is currently assigned to rt5677_of_match.type. Fix this. The problem was found with the help of clang: sound/soc/codecs/rt5677.c:5010:36: warning: expression which evaluates to zero treated as a null pointer constant of type 'const void *' [-Wnon-literal-null-conversion] { .compatible = "realtek,rt5677", RT5677 }, ^~~~~~ Fixes: ddc9e69b9dc2 ("ASoC: rt5677: Hide platform data in the module sources") Signed-off-by: Matthias Kaehlcke <mka@chromium.org> -- Changes in v2: - assign device id to data instead of 'type' - updated subject and commit message - added: 'Fixes' tag --- sound/soc/codecs/rt5677.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)