staging: iio: frequency: ad9832: fix division by zero in ad9832_calc_freqreg()
In the ad9832_write_frequency() function, clk_get_rate() might return 0.
This can lead to a division by zero when calling ad9832_calc_freqreg().
The check if (fout > (clk_get_rate(st->mclk) / 2)) does not protect
against the case when fout is 0. The ad9832_write_frequency() function
is called from ad9832_write(), and fout is derived from a text buffer,
which can contain any value.
Handle the case where -EOPNOTSUPP is returned from OTP driver.
This addresses an issue that occurs with the Intel SPI flash controller,
which has a limited supported opcode set. Whilst the OTP functionality
is not available due to this restriction, other parts of the MTD
functionality of the device are intact. This change allows the driver
to gracefully handle the restriction by allowing the supported
functionality to remain available instead of failing the probe
altogether.
Signed-off-by: Aapo Vienamo <email address hidden>
Reviewed-by: Mika Westerberg <email address hidden>
Reviewed-by: Michael Walle <email address hidden>
Signed-off-by: Miquel Raynal <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit fe0b8213c0129ff2419458343d8d8e716b1495c0)
Signed-off-by: Aaron Ma <email address hidden>
Acked-by: Jacob Martin <email address hidden>
Acked-by: Tim Whisonant <email address hidden>
Signed-off-by: Koichiro Den <email address hidden>
[ add do_tools_bpftool_stub to avoid hardcoding the arch in rules ]
Signed-off-by: Timo Aaltonen <email address hidden>
(cherry-picked from commit 0c32444afa9bd036e66cbc8c05dbd8df8388bc6f oracular:linux)
Signed-off-by: Mehmet Basaran <email address hidden>
dede9e7...
by
Alexey Makhalov <email address hidden>
No more direct use of these macros should be allowed. The vmware_hypercallX API
still uses the new implementation of VMWARE_HYPERCALL macro internally, but it
is not exposed outside of the vmware.h.
VCPU_RESERVED and LEGACY_X2APIC are not VMware hypercall commands. These are
bits in the return value of the VMWARE_CMD_GETVCPU_INFO command. Change
VMWARE_CMD_ prefix to GETVCPU_INFO_ one. And move the bit-shift
operation into the macro body.
Fixes: 4cca6ea04d31c ("x86/apic: Allow x2apic without IR on VMware platform")
Signed-off-by: Alexey Makhalov <email address hidden>
Signed-off-by: Borislav Petkov (AMD) <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit 86cb65448d07fe516e18d9512ae5786cd90db9bf)
Signed-off-by: Thibault Ferrante <email address hidden>
Acked-by: Jacob Martin <email address hidden>
Acked-by: Juerg Haefliger <email address hidden>
Signed-off-by: Mehmet Basaran <email address hidden>
f33e21c...
by
Alexey Makhalov <email address hidden>