@@ -112,8 +112,6 @@ int stream_flash_buffered_write(struct stream_flash_ctx *ctx, const u8_t *data,
112
112
int processed = 0 ;
113
113
int rc = 0 ;
114
114
int buf_empty_bytes ;
115
- size_t fill_length ;
116
- u8_t filler ;
117
115
118
116
if (!ctx || !data ) {
119
117
return - EFAULT ;
@@ -146,27 +144,6 @@ int stream_flash_buffered_write(struct stream_flash_ctx *ctx, const u8_t *data,
146
144
}
147
145
148
146
if (flush && ctx -> buf_bytes > 0 ) {
149
- fill_length = flash_get_write_block_size (ctx -> fdev );
150
- if (ctx -> buf_bytes % fill_length ) {
151
- fill_length -= ctx -> buf_bytes % fill_length ;
152
- /*
153
- * Leverage the fact that unwritten memory
154
- * should be erased in order to get the erased
155
- * byte-value.
156
- */
157
- rc = flash_read (ctx -> fdev ,
158
- ctx -> offset + ctx -> bytes_written ,
159
- (void * )& filler ,
160
- 1 );
161
-
162
- if (rc != 0 ) {
163
- return rc ;
164
- }
165
-
166
- memset (ctx -> buf + ctx -> buf_bytes , filler , fill_length );
167
- ctx -> buf_bytes += fill_length ;
168
- }
169
-
170
147
rc = flash_sync (ctx );
171
148
}
172
149
@@ -191,11 +168,6 @@ int stream_flash_init(struct stream_flash_ctx *ctx, struct device *fdev,
191
168
const struct flash_pages_layout * layout ;
192
169
const struct flash_driver_api * api = fdev -> driver_api ;
193
170
194
- if (buf_len % flash_get_write_block_size (fdev )) {
195
- LOG_ERR ("Buffer size is not aligned to minimal write-block-size" );
196
- return - EFAULT ;
197
- }
198
-
199
171
/* Calculate the total size of the flash device */
200
172
api -> page_layout (fdev , & layout , & layout_size );
201
173
for (int i = 0 ; i < layout_size ; i ++ ) {
0 commit comments