08 Oct, 2020

1 commit

  • drxk_hard.c: In function 'hi_command.constprop':
    drxk_hard.c:1016:5: warning: 'wait_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized]
    1015 | } while ((status < 0) && (retry_count < DRXK_MAX_RETRIES)
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1016 | && (wait_cmd != 0));
    | ^~~~~~~~~~~~~~~~~~

    The underlying cause is that the while condition is wrong. It should be:

    (status < 0 || wait_cmd) && (retry_count < DRXK_MAX_RETRIES)

    'wait_cmd' is only valid if '!(status < 0)'.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

01 Oct, 2020

1 commit


27 Sep, 2020

2 commits

  • Constify a number of static structs that were not modified. In order to
    be able to do that, const input arguments to a couple of functions that
    not modify their argument. This allows the compiler to put them in
    read-only memory, resulting in about 6k memory being read-only, and the
    resulting module is 400 bytes smaller.

    Before:
    text data bss dec hex filename
    15492 6873 0 22365 575d drivers/media/dvb-frontends/tda18271c2dd.ko

    After:
    text data bss dec hex filename
    21021 897 0 21918 559e drivers/media/dvb-frontends/tda18271c2dd.ko

    Signed-off-by: Rikard Falkeborn
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Rikard Falkeborn
     
  • If rtl2832_sdr_probe() encounters an unsupported tuner it cleans up
    everything and returns 0. This can result in various bad things later.
    The patch sets the error code on the corresponding path.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Evgeny Novikov
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Evgeny Novikov
     

07 Sep, 2020

1 commit

  • Linux 5.9-rc4

    * tag 'v5.9-rc4': (1001 commits)
    Linux 5.9-rc4
    io_uring: fix linked deferred ->files cancellation
    io_uring: fix cancel of deferred reqs with ->files
    include/linux/log2.h: add missing () around n in roundup_pow_of_two()
    mm/khugepaged.c: fix khugepaged's request size in collapse_file
    mm/hugetlb: fix a race between hugetlb sysctl handlers
    mm/hugetlb: try preferred node first when alloc gigantic page from cma
    mm/migrate: preserve soft dirty in remove_migration_pte()
    mm/migrate: remove unnecessary is_zone_device_page() check
    mm/rmap: fixup copying of soft dirty and uffd ptes
    mm/migrate: fixup setting UFFD_WP flag
    mm: madvise: fix vma user-after-free
    checkpatch: fix the usage of capture group ( ... )
    fork: adjust sysctl_max_threads definition to match prototype
    ipc: adjust proc_ipc_sem_dointvec definition to match prototype
    mm: track page table modifications in __apply_to_page_range()
    MAINTAINERS: IA64: mark Status as Odd Fixes only
    MAINTAINERS: add LLVM maintainers
    MAINTAINERS: update Cavium/Marvell entries
    mm: slub: fix conversion of freelist_corrupted()
    ...

    Mauro Carvalho Chehab
     

03 Sep, 2020

3 commits

  • Fix the following versioncheck warning:

    drivers/media/dvb-frontends/mxl5xx.c:30:1: unused including

    Reported-by: Hulk Robot
    Signed-off-by: Jason Yan
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Jason Yan
     
  • The usage of castings and float point when checking for
    the setup based at the symbol_rate cause those warnings
    with smatch:

    drivers/media/dvb-frontends/tda10021.c:153 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
    drivers/media/dvb-frontends/tda10021.c:155 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
    drivers/media/dvb-frontends/tda10021.c:157 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.
    drivers/media/dvb-frontends/tda10021.c:159 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero.

    While the code should work with gcc, as it will evaluate the
    values into a constant before compiling, other compilers
    could do otherwise. So, get rid of float pointing math on it,
    avoiding the need of doing typecasts.

    While here, cleanup some coding style issues at the related
    code.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The original logic had an integer to unsigned integer
    conversion, plus a float-point math. While gcc should be
    able to do the match at compile time, other compilers might
    not do the same. Also, those produce the following warnings
    with static code analyzers:

    drivers/media/dvb-frontends/tda10086.c:300 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:303 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:306 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:309 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:312 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:315 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:318 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:321 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:324 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.
    drivers/media/dvb-frontends/tda10086.c:327 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero.

    Change the logic to declare the reference constant as unsigned
    and to not use float point math.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

29 Aug, 2020

2 commits

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva
    Acked-by: Sakari Ailus
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Gustavo A. R. Silva
     
  • Fix the following coccinelle report:

    drivers/media/dvb-frontends/mb86a16.c:1455:6-8:
    WARNING: possible condition with no effect (if == else)

    Both branches are the same, so remove the if/else altogether.

    Found using - Coccinelle (http://coccinelle.lip6.fr)

    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

08 Aug, 2020

1 commit

  • Pull media updates from Mauro Carvalho Chehab:

    - Legacy soc_camera driver was removed from staging

    - New I2C sensor related drivers: dw9768, ch7322, max9271, rdacm20

    - TI vpe driver code was re-organized and had new features added

    - Added Xilinx MIPI CSI-2 Rx Subsystem driver

    - Added support for Infrared Toy and IR Droid devices

    - Lots of random driver fixes, new features and cleanups

    * tag 'media/v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (318 commits)
    media: camss: fix memory leaks on error handling paths in probe
    media: davinci: vpif_capture: fix potential double free
    media: radio: remove redundant assignment to variable retval
    media: allegro: fix potential null dereference on header
    media: mtk-mdp: Fix a refcounting bug on error in init
    media: allegro: fix an error pointer vs NULL check
    media: meye: fix missing pm_mchip_mode field
    media: cafe-driver: use generic power management
    media: saa7164: use generic power management
    media: v4l2-dev/ioctl: Fix document for VIDIOC_QUERYCAP
    media: v4l2: Correct kernel-doc inconsistency
    media: v4l2: Correct kernel-doc inconsistency
    media: dvbdev.h: keep * together with the type
    media: v4l2-subdev.h: keep * together with the type
    media: videobuf2: Print videobuf2 buffer state by name
    media: colorspaces-details.rst: fix V4L2_COLORSPACE_JPEG description
    media: tw68: use generic power management
    media: meye: use generic power management
    media: cx88: use generic power management
    media: cx25821: use generic power management
    ...

    Linus Torvalds
     

19 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Alexander A. Klimov
     

17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

04 Jul, 2020

1 commit

  • This function has never been used. Found with clang:

    drivers/media/dvb-frontends/drxk_hard.c:159:19: warning: unused function 'MulDiv32' [-Wunused-function]
    static inline u32 MulDiv32(u32 a, u32 b, u32 c)

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young
     

12 May, 2020

3 commits


29 Apr, 2020

1 commit


21 Apr, 2020

2 commits


17 Apr, 2020

1 commit

  • Using select for DVB_CORE doesn't work, as reported by
    Randy:

    CONFIG_I2C=m
    CONFIG_DVB_CORE=y

    ld: drivers/media/dvb-core/dvbdev.o: in function `dvb_module_probe':
    dvbdev.c:(.text+0xf92): undefined reference to `i2c_new_client_device'
    ld: dvbdev.c:(.text+0xffb): undefined reference to `i2c_unregister_device'
    ld: drivers/media/dvb-core/dvbdev.o: in function `dvb_module_release':
    dvbdev.c:(.text+0x107d): undefined reference to `i2c_unregister_device'

    The problem is actually caused by the dummy frontend driver,
    which uses select, and it is missing an I2C dependency:

    WARNING: unmet direct dependencies detected for DVB_CORE
    Depends on [m]: MEDIA_SUPPORT [=y] && MEDIA_DIGITAL_TV_SUPPORT [=y] && (I2C [=m] || I2C [=m]=n)
    Selected by [y]:
    - DVB_DUMMY_FE [=y] && MEDIA_SUPPORT [=y] && MEDIA_TEST_SUPPORT [=y]

    As this is the only frontend driver using "select DVB_CORE",
    change it do depends on DVB_CORE.

    Reported-by: Randy Dunlap
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

16 Apr, 2020

1 commit

  • There are *lots* of I2C ancillary drivers. While we're using
    comments to group them, all options appear at the same menu.

    It should be a lot clearer to group them into sub-menus, with
    may help people to go directly to the driver(s) he's needing
    to enable.

    Suggested-by: Hans Verkuil
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

14 Apr, 2020

4 commits

  • Those documents don't really describe the driver API.

    Instead, they contain development-specific information.

    Yet, as the main index file describes the content of it as:

    "how specific kernel subsystems work
    from the point of view of a kernel developer"

    It seems to be the better fit.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Most of media Kconfig/Makefile files already has SPDX,
    but there are a few ones still missing. Add it to them.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • There are some long-time mistakes related to build test
    drivers, with regards to depends on/select. Also, as we
    now want to build any test driver without needing to
    enable anything else, change the logic in order to properly
    filter them.

    Please notice that the PCI skeleton is somewhat an
    exception, as it requires to select *both* SAMPLES and
    MEDIA_TEST_SUPPORT. I almost changed it to be either one,
    but decided to keep it as-is, as this is something that
    we don't really need to be included on any distribution.

    The only reason for someone to build it is for COMPILE_TEST
    purposes.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Neither the PCI skeleton nor the DVB dummy driver are real
    drivers. They're there just as an example for a driver
    writter.

    Distros should not enable those drivers. So, hide them if
    MEDIA_TEST_SUPPORT is not selected.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     

12 Mar, 2020

2 commits

  • The shifting of buf[3] by 24 bits to the left will be promoted to
    a 32 bit signed int and then sign-extended to an unsigned long. In
    the unlikely event that the the top bit of buf[3] is set then all
    then all the upper bits end up as also being set because of
    the sign-extension and this affect the ev->post_bit_error sum.
    Fix this by using the temporary u32 variable bit_error to avoid
    the sign-extension promotion. This also removes the need to do the
    computation twice.

    Addresses-Coverity: ("Unintended sign extension")

    Fixes: 267897a4708f ("[media] tda10071: implement DVBv5 statistics")
    Signed-off-by: Colin Ian King
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Colin Ian King
     
  • The ds3103b demodulator identifies as an m88rs600, but requires different
    clock settings and firmware, along with differences in register settings.

    Changes were reverse engineered using an instrumented downstream GPLv2
    driver to compare i2c traffic and clocking. The mclk functions are from
    the downstream GPLv2 driver.

    Signed-off-by: Brad Love
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Brad Love
     

24 Feb, 2020

1 commit


09 Jan, 2020

4 commits


08 Jan, 2020

6 commits

  • This patch fixes the following scripts/checkpatch.pl errors:

    ERROR: space required before the open parenthesis '('
    + switch(input) {

    Suggested-by: Shuah Khan
    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     
  • This patch fixes the following scripts/checkpatch.pl error:

    ERROR: open brace '{' following function definitions go on the next line
    +static int as102_fe_get_tune_settings(struct dvb_frontend *fe,
    + struct dvb_frontend_tune_settings *settings) {

    Suggested-by: Shuah Khan
    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     
  • Replaces printk with pr_err to fix warnings from checkpatch.pl

    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     
  • Fix checkpatch.pl error by adding a blank line

    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     
  • Change foo* bar to foo *bar to avoid ERROR: POINTER_LOCATION in checkpatch

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_sleep(struct dvb_frontend* fe)

    ERROR: "foo* bar" should be "foo *bar"
    +static int dvb_dummy_fe_init(struct dvb_frontend* fe)

    ERROR: "foo* bar" should be "foo *bar"
    +static void dvb_dummy_fe_release(struct dvb_frontend* fe)

    ERROR: "foo* bar" should be "foo *bar"
    + struct dvb_dummy_fe_state* state = fe->demodulator_priv;

    ERROR: "foo* bar" should be "foo *bar"
    +struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)

    ERROR: "foo* bar" should be "foo *bar"
    + struct dvb_dummy_fe_state* state = NULL;

    ERROR: "foo* bar" should be "foo *bar"
    + struct dvb_dummy_fe_state* state = NULL;

    ERROR: "foo* bar" should be "foo *bar"
    + struct dvb_dummy_fe_state* state = NULL;

    remove 'extern' keyword from declaration

    Fix CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files
    by removing it.

    Fix long lines

    Break long lines into smaller ones to improve readability.

    WARNING: line over 80 characters
    + memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));

    WARNING: line over 80 characters
    + memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
    WARNING: line over 80 characters
    + memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));

    WARNING: line over 80 characters
    + FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |

    WARNING: line over 80 characters
    + FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |

    WARNING: line over 80 characters
    + FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |

    WARNING: line over 80 characters
    + .symbol_rate_min = (57840000 / 2) / 6

    Suggested-by: Shuah Khan
    Signed-off-by: Daniel W. S. Almeida
    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Daniel W. S. Almeida
     
  • drivers/media/dvb-frontends/dib0090.c:1751:67: warning: format specifies type 'short' but the argument has type 'u8' (aka 'unsigned char') [-Wformat]
    dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step);
    ~~~ ^~~~~~~~~~~~~~~
    %hhu
    drivers/media/dvb-frontends/dib0090.c:30:22: note: expanded from macro 'dprintk'
    __func__, ##arg); \
    ^~~
    drivers/media/dvb-frontends/dib0090.c:1751:101: warning: format specifies type 'short' but the argument has type 's8' (aka 'signed char') [-Wformat]
    dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step);
    ~~~ ^~~~~~~~~~~
    %hhd
    drivers/media/dvb-frontends/dib0090.c:30:22: note: expanded from macro 'dprintk'
    __func__, ##arg); \
    ^~~

    Signed-off-by: Sean Young
    Signed-off-by: Mauro Carvalho Chehab

    Sean Young