1029484 Commits

Author SHA1 Message Date
Paul Kocialkowski
c3609c45b7 media: v4l2-subdev: Fix documentation of the subdev_notifier member
Fix the name of the function that registers the subdev_notifier member
of the v4l2_subdev structure.

[Sakari Ailus: Drop _sensor from the function name.]

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-08-04 14:43:49 +02:00
Dongliang Mu
6fa54bc713 media: em28xx-input: fix refcount bug in em28xx_usb_disconnect
If em28xx_ir_init fails, it would decrease the refcount of dev. However,
in the em28xx_ir_fini, when ir is NULL, it goes to ref_put and decrease
the refcount of dev. This will lead to a refcount bug.

Fix this bug by removing the kref_put in the error handling code
of em28xx_ir_init.

refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 7 at lib/refcount.c:28 refcount_warn_saturate+0x18e/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 7 Comm: kworker/0:1 Not tainted 5.13.0 #3
Workqueue: usb_hub_wq hub_event
RIP: 0010:refcount_warn_saturate+0x18e/0x1a0 lib/refcount.c:28
Call Trace:
  kref_put.constprop.0+0x60/0x85 include/linux/kref.h:69
  em28xx_usb_disconnect.cold+0xd7/0xdc drivers/media/usb/em28xx/em28xx-cards.c:4150
  usb_unbind_interface+0xbf/0x3a0 drivers/usb/core/driver.c:458
  __device_release_driver drivers/base/dd.c:1201 [inline]
  device_release_driver_internal+0x22a/0x230 drivers/base/dd.c:1232
  bus_remove_device+0x108/0x160 drivers/base/bus.c:529
  device_del+0x1fe/0x510 drivers/base/core.c:3540
  usb_disable_device+0xd1/0x1d0 drivers/usb/core/message.c:1419
  usb_disconnect+0x109/0x330 drivers/usb/core/hub.c:2221
  hub_port_connect drivers/usb/core/hub.c:5151 [inline]
  hub_port_connect_change drivers/usb/core/hub.c:5440 [inline]
  port_event drivers/usb/core/hub.c:5586 [inline]
  hub_event+0xf81/0x1d40 drivers/usb/core/hub.c:5668
  process_one_work+0x2c9/0x610 kernel/workqueue.c:2276
  process_scheduled_works kernel/workqueue.c:2338 [inline]
  worker_thread+0x333/0x5b0 kernel/workqueue.c:2424
  kthread+0x188/0x1d0 kernel/kthread.c:319
  ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Reported-by: Dongliang Mu <mudongliangabcd@gmail.com>
Fixes: ac5688637144 ("media: em28xx: Fix possible memory leak of em28xx struct")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-08-04 14:43:49 +02:00
Viktor Prutyanov
49be1c78d5 media: rc: introduce Meson IR TX driver
This patch adds the driver for Amlogic Meson IR transmitter.

Some Amlogic SoCs such as A311D and T950D4 have IR transmitter
(also called blaster) controller onboard. It is capable of sending
IR signals with arbitrary carrier frequency and duty cycle.

The driver supports 2 modulation clock sources:
 - xtal3 clock (xtal divided by 3)
 - 1us clock

Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-08-04 14:43:49 +02:00
Viktor Prutyanov
e9f504f7b5 media: rc: meson-ir-tx: document device tree bindings
This patch adds binding documentation for the IR transmitter
available in Amlogic Meson SoCs.

Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-08-04 14:43:49 +02:00
Mauro Carvalho Chehab
a7a48b40c7 Merge commit 'c3cdc019a6bf' into media_tree
* commit 'c3cdc019a6bf':
  media: atomisp: pci: reposition braces as per coding style
  media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
  media: atomisp: Move MIPI_PORT_LANES to the only user
  media: atomisp: Perform a single memset() for union
  media: atomisp: pci: fix error return code in atomisp_pci_probe()
  media: atomisp: pci: Remove unnecessary (void *) cast
  media: atomisp: pci: Remove checks before kfree/kvfree
  media: atomisp: Remove unused port_enabled variable
  media: atomisp: Annotate a couple of definitions with __maybe_unused
  media: atomisp: Remove unused declarations
  media: atomisp: remove the repeated declaration
  media: atomisp: improve error handling in gc2235_detect()
  media: atomisp: Fix whitespace at the beginning of line
  media: atomisp: Align block comments
  media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
  media: atomisp: Fix line continuation style issue in sh_css.c
  media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
  media: atomisp: Remove unnecessary parens in sh_css.c
  media: atomisp: Resolve goto style issue in sh_css.c
  media: atomisp: fix the uninitialized use and rename "retvalue"
2021-08-03 15:36:58 +02:00
Deepak R Varma
c3cdc019a6 media: atomisp: pci: reposition braces as per coding style
Misplaced braces makes it difficult to follow the code easily. This also
goes against the code style guidelines. This resolved following checkpatch
complaints:

ERROR: open brace '{' following function definitions go on the next line
ERROR: that open brace { should be on the previous line

Link: https://lore.kernel.org/linux-media/YIwk3KbVGRPJwKa4@dU2104

[mchehab: dropped a hunk with a merge conflict]
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, drv@mailo.com # X-LSpam-Score: -7.3 (-------)
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Martiros Shakhzadyan
f83f86e726 media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
Remove a superfluous clause in mt9m114_s_power()

Link: https://lore.kernel.org/linux-media/20210719055216.28508-1-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Andy Shevchenko
a5e5ceae59 media: atomisp: Move MIPI_PORT_LANES to the only user
Move MIPI_PORT_LANES to the only user of it, i.e. pci/runtime/isys/src/rx.c.

Link: https://lore.kernel.org/linux-media/20210713152523.19902-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Kees Cook
69aa1deeab media: atomisp: Perform a single memset() for union
There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:

In function 'fortify_memset_chk',
    inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
    inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
  199 |    __write_overflow_field();
      |    ^~~~~~~~~~~~~~~~~~~~~~~~

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419

Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Yang Yingliang
d27f346aa9 media: atomisp: pci: fix error return code in atomisp_pci_probe()
If init_atomisp_wdts() fails, atomisp_pci_probe() need return
error code.

Link: https://lore.kernel.org/linux-media/20210617072329.1233662-1-yangyingliang@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Fabio M. De Francesco
454a6232e2 media: atomisp: pci: Remove unnecessary (void *) cast
Removed an unnecessary (void *) cast for an argument passed to kfree().

Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:03 +02:00
Fabio M. De Francesco
1c6edb2831 media: atomisp: pci: Remove checks before kfree/kvfree
Removed checks for pointers != NULL before freeing memory. If kvfree()
and kfree() are given NULL pointers no operations are performed, so
there is no need for the above-mentioned checks. Coccinelle detected the
second of the two unnecessary checks.

Link: https://lore.kernel.org/linux-media/20210527193922.25225-1-fmdefrancesco@gmail.com
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Andy Shevchenko
693064eafa media: atomisp: Remove unused port_enabled variable
Remove unused port_enabled variable in ia_css_isys_rx_configure().

Link: https://lore.kernel.org/linux-media/20210526124322.48915-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Andy Shevchenko
dbe93bc970 media: atomisp: Annotate a couple of definitions with __maybe_unused
There are definitions in the header that are not used by all modules inside
the driver. Annotate them with __maybe_unused to avoid compiler warnings.

Link: https://lore.kernel.org/linux-media/20210526124322.48915-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Andy Shevchenko
85001df54b media: atomisp: Remove unused declarations
There is a few static declarations that are not used anywhere, remove them.

Link: https://lore.kernel.org/linux-media/20210526124322.48915-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Shaokun Zhang
0ae19e8c08 media: atomisp: remove the repeated declaration
Function 'ia_css_mmu_invalidate_cache' is declared twice, remove the
repeated declaration.

Link: https://lore.kernel.org/linux-media/1621922559-1859-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Tom Rix
280355522d media: atomisp: improve error handling in gc2235_detect()
Static analysis reports this representative problem

atomisp-gc2235.c:867:20: warning: The right operand
  of '|' is a garbage value
        id = ((high << 8) | low);
                          ^ ~~~
When gc2235_read_reg() fails, its return val is never written.

For gc2235_detect(), high and low are or-ed and compared
with GC2235_ID, 0x2235.  Initialize both to 0 and skip
checking the read returns, it's errors are not passed up, only
-ENODEV is.

Link: https://lore.kernel.org/linux-media/20210521194805.2078135-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Aniket Bhattacharyea
6bdad3bb7e media: atomisp: Fix whitespace at the beginning of line
This patch fixes whitespace at the beginning of line by wrapping after
the type name and aligning the arguments with the open parenthesis.
Identified by checkpatch: WARNING: please, no spaces at the start of a
line.

Link: https://lore.kernel.org/linux-media/20210524173609.672153-1-aniketmail669@gmail.com
Signed-off-by: Aniket Bhattacharyea <aniketmail669@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Jiabing Wan
b09ea93862 media: atomisp: Align block comments
Fixing the following checkpatch warning:
WARNING: Block comments should align the * on each line

Link: https://lore.kernel.org/linux-media/20210518112938.88240-1-wanjiabing@vivo.com
Signed-off-by: Jiabing Wan <kael_w@yeah.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Nguyen Dinh Phi
e53656ab8c media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.

Link: https://lore.kernel.org/linux-media/20210513034650.252993-1-phind.uet@gmail.com
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Martiros Shakhzadyan
66b22424ad media: atomisp: Fix line continuation style issue in sh_css.c
Fix logical continuation style issue and adjacent line splits.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-5-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Martiros Shakhzadyan
d2f3009e86 media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
Use kcalloc instead of kzalloc with multiplication.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-4-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Martiros Shakhzadyan
a93cf5a505 media: atomisp: Remove unnecessary parens in sh_css.c
Remove unnecessary parenthesis.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Martiros Shakhzadyan
9e77871a59 media: atomisp: Resolve goto style issue in sh_css.c
Change the goto label to lower case.
Remove a space in the goto label.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-2-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:04:02 +02:00
Yizhuo
0c980e3f52 media: atomisp: fix the uninitialized use and rename "retvalue"
Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Link: https://lore.kernel.org/linux-media/20210625053858.3862-1-yzhai003@ucr.edu
Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-23 09:03:32 +02:00
Deepak R Varma
c27479d762 media: atomisp: pci: reposition braces as per coding style
Misplaced braces makes it difficult to follow the code easily. This also
goes against the code style guidelines. This resolved following checkpatch
complaints:

ERROR: open brace '{' following function definitions go on the next line
ERROR: that open brace { should be on the previous line

Link: https://lore.kernel.org/linux-media/YIwk3KbVGRPJwKa4@dU2104

[mchehab: dropped a hunk with a merge conflict]
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, drv@mailo.com # X-LSpam-Score: -7.3 (-------)
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:57 +02:00
Martiros Shakhzadyan
278cc35d75 media: atomisp: i2c: Remove a superfluous else clause in atomisp-mt9m114.c
Remove a superfluous clause in mt9m114_s_power()

Link: https://lore.kernel.org/linux-media/20210719055216.28508-1-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:57 +02:00
Andy Shevchenko
70d4ac6fb0 media: atomisp: Move MIPI_PORT_LANES to the only user
Move MIPI_PORT_LANES to the only user of it, i.e. pci/runtime/isys/src/rx.c.

Link: https://lore.kernel.org/linux-media/20210713152523.19902-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:57 +02:00
Kees Cook
1d74a91dc5 media: atomisp: Perform a single memset() for union
There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:

In function 'fortify_memset_chk',
    inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
    inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
  199 |    __write_overflow_field();
      |    ^~~~~~~~~~~~~~~~~~~~~~~~

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419

Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:57 +02:00
Yang Yingliang
d14e272958 media: atomisp: pci: fix error return code in atomisp_pci_probe()
If init_atomisp_wdts() fails, atomisp_pci_probe() need return
error code.

Link: https://lore.kernel.org/linux-media/20210617072329.1233662-1-yangyingliang@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Fabio M. De Francesco
655ace3c74 media: atomisp: pci: Remove unnecessary (void *) cast
Removed an unnecessary (void *) cast for an argument passed to kfree().

Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Fabio M. De Francesco
179b1fce5d media: atomisp: pci: Remove checks before kfree/kvfree
Removed checks for pointers != NULL before freeing memory. If kvfree()
and kfree() are given NULL pointers no operations are performed, so
there is no need for the above-mentioned checks. Coccinelle detected the
second of the two unnecessary checks.

Link: https://lore.kernel.org/linux-media/20210527193922.25225-1-fmdefrancesco@gmail.com
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Andy Shevchenko
a5d46d9afb media: atomisp: Remove unused port_enabled variable
Remove unused port_enabled variable in ia_css_isys_rx_configure().

Link: https://lore.kernel.org/linux-media/20210526124322.48915-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Andy Shevchenko
86d92c3ad7 media: atomisp: Annotate a couple of definitions with __maybe_unused
There are definitions in the header that are not used by all modules inside
the driver. Annotate them with __maybe_unused to avoid compiler warnings.

Link: https://lore.kernel.org/linux-media/20210526124322.48915-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Andy Shevchenko
8e38adf99d media: atomisp: Remove unused declarations
There is a few static declarations that are not used anywhere, remove them.

Link: https://lore.kernel.org/linux-media/20210526124322.48915-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Shaokun Zhang
d741db71cf media: atomisp: remove the repeated declaration
Function 'ia_css_mmu_invalidate_cache' is declared twice, remove the
repeated declaration.

Link: https://lore.kernel.org/linux-media/1621922559-1859-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Tom Rix
544ee7306d media: atomisp: improve error handling in gc2235_detect()
Static analysis reports this representative problem

atomisp-gc2235.c:867:20: warning: The right operand
  of '|' is a garbage value
        id = ((high << 8) | low);
                          ^ ~~~
When gc2235_read_reg() fails, its return val is never written.

For gc2235_detect(), high and low are or-ed and compared
with GC2235_ID, 0x2235.  Initialize both to 0 and skip
checking the read returns, it's errors are not passed up, only
-ENODEV is.

Link: https://lore.kernel.org/linux-media/20210521194805.2078135-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Aniket Bhattacharyea
f89aa0d174 media: atomisp: Fix whitespace at the beginning of line
This patch fixes whitespace at the beginning of line by wrapping after
the type name and aligning the arguments with the open parenthesis.
Identified by checkpatch: WARNING: please, no spaces at the start of a
line.

Link: https://lore.kernel.org/linux-media/20210524173609.672153-1-aniketmail669@gmail.com
Signed-off-by: Aniket Bhattacharyea <aniketmail669@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Jiabing Wan
95d2117cfe media: atomisp: Align block comments
Fixing the following checkpatch warning:
WARNING: Block comments should align the * on each line

Link: https://lore.kernel.org/linux-media/20210518112938.88240-1-wanjiabing@vivo.com
Signed-off-by: Jiabing Wan <kael_w@yeah.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Nguyen Dinh Phi
2c08a018f0 media: atomisp: Use sysfs_emit() instead of sprintf() where appropriate
sysfs_emit() is preferred over raw sprintf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in sanity checks.

Link: https://lore.kernel.org/linux-media/20210513034650.252993-1-phind.uet@gmail.com
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Martiros Shakhzadyan
6b6d228313 media: atomisp: Fix line continuation style issue in sh_css.c
Fix logical continuation style issue and adjacent line splits.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-5-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Martiros Shakhzadyan
00ba215607 media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c
Use kcalloc instead of kzalloc with multiplication.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-4-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Martiros Shakhzadyan
f6e2a76d44 media: atomisp: Remove unnecessary parens in sh_css.c
Remove unnecessary parenthesis.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Martiros Shakhzadyan
7f52dbb8f7 media: atomisp: Resolve goto style issue in sh_css.c
Change the goto label to lower case.
Remove a space in the goto label.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-2-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:56 +02:00
Baokun Li
9d971b8135 media: atomisp: use list_splice_init in atomisp_compat_css20.c
Using list_splice_init() instead of entire while-loops
in atomisp_compat_css20.c.

Link: https://lore.kernel.org/linux-media/20210617140926.887680-1-libaokun1@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00
Yizhuo
c275e5d349 media: atomisp: fix the uninitialized use and rename "retvalue"
Inside function mt9m114_detect(), variable "retvalue" could
be uninitialized if mt9m114_read_reg() returns error, however, it
is used in the later if statement, which is potentially unsafe.

The local variable "retvalue" is renamed to "model" to avoid
confusion.

Link: https://lore.kernel.org/linux-media/20210625053858.3862-1-yzhai003@ucr.edu
Fixes: ad85094 (media / atomisp: fix the uninitialized use of model ID)
Signed-off-by: Yizhuo <yzhai003@ucr.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00
Pavel Skripkin
264f590899 media: atomisp: remove useless returns
Returns are not useful at the end of void functions,
they can simply be removed.

Link: https://lore.kernel.org/linux-media/23a6984ddfb15ba38f6983381bb6fdaef3edd7d8.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00
Pavel Skripkin
728a5c64ae media: atomisp: remove dublicate code
Removed dublicate returns and breaks inside switch
statements and useless return after switch.

Link: https://lore.kernel.org/linux-media/3944cd10bb5a64157781b1e0ef044c62c05f07c7.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00
Pavel Skripkin
9763267eda media: atomisp: remove useless breaks
Breaks are not useful after a return, they can
simply be removed.

Link: https://lore.kernel.org/linux-media/4b4a6ad1bc8fc1fd6aafc3e6cd7a4969890340c1.1620479607.git.paskripkin@gmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00
Dmitrii Wolf
24d4fbdc9a media: atomisp: pci: fixed a curly bracket coding style issue.
Fixed a coding style issue.

Link: https://lore.kernel.org/linux-media/20210411134840.7184-1-dev.dragon@bk.ru
Signed-off-by: Dmitrii Wolf <dev.dragon@bk.ru>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-07-22 14:01:55 +02:00